title: Az.Functions Module in Azure function throwing Error
body: <p>I am trying to create a PowerShell function app that contains a function - a timer trigger that can start and stop another function app at a specific time.</p>
  <p>I was motivated to try out the personal project after coming across <a href="https://cloudtenn.hashnode.dev/stop-and-start-vm-using-azure-function" rel="nofollow noreferrer">this blog</a> about automating start and stop time for Virtual Machine on Azure using timer trigger function.</p>
  <p>The issue is from the Az.Functions module which I need to run a line of code</p>
  <pre><code>$fnapps = Get-AzFunctionApp
  </code></pre>
  <p>It runs well for the first time (No known or seen error in the logs and the output is correct). But at the second instance and other instances of running on the CRON schedule I set, I see this exception error from the module.</p>
  <p>The error code is:</p>
  <pre><code>You cannot call a method on a null-valued expression.Exception             :Type        : System.Management.Automation.RuntimeExceptionErrorRecord :Exception             :Type    : System.Management.Automation.ParentContainsErrorRecordExceptionMessage : You cannot call a method on a null-valued expression.HResult : -2146233087CategoryInfo          : InvalidOperation: (:) [], ParentContainsErrorRecordExceptionFullyQualifiedErrorId : InvokeMethodOnNullInvocationInfo        :ScriptLineNumber : 450OffsetInLine     : 24HistoryId        : -1ScriptName       : 
  </code></pre>
  <p>I want to know if there's something I'm missing about Az.Functions Module.</p>
  <p>Also want to know if what I am trying to do is possible.</p>
  <p>Note: I've confirmed the modules are installed correctly, and no issue in the other parts of the code.</p>
  <p>Thanks.</p>