title: Receive "must call the Connect-AzureAD" even I run it before
body: <p><strong>My problem</strong></p>
  <p>I try to run <strong>Get-AzureADGroup</strong> connected with an App Registration, but get this error message:</p>
  <blockquote>
  <p>Get-AzureADGroup : You must call the Connect-AzureAD cmdlet before
  calling any other cmdlets.</p>
  </blockquote>
  <p>But what I am running is:</p>
  <pre><code>$secPasswd = ConvertTo-SecureString $secret -AsPlainText -Force
  $cred = New-Object -TypeName System.Management.Automation.PSCredential($appId , $secpasswd)
  Connect-AzAccount -Credential $cred -ServicePrincipal -Tenant $tenantId 
  
  $gpe = Get-AzureADGroup -SearchString &quot;group1&quot;  
  </code></pre>
  <p><strong>Connect-AzAccount</strong> is run, so I don't understand this error message.</p>
  <p><strong>My execution context</strong></p>
  <p>I just created an App Registration and a secret to connect with.</p>
  <p><strong>What I need</strong></p>
  <ul>
  <li>Why do I get this message since I run <strong>Connect-AzureD</strong>?</li>
  <li>What should I do?</li>
  </ul>
  <p>Thanks</p>