Share via

Get-AzADGroupMember not working

Apurva Pathak 890 Reputation points
2024-02-16T13:06:10.4866667+00:00

Hi folks, I am using Azure AD PowerShell to query group members of an Azure AD group using its object Id. But weirdly enough the command says the object does not exist, but it does. I ruled out any spaces etc. in the input file but of no joy. I was using the same script and same input file until last Wednesday and it was all working, but suddenly it stopped. Could anyone please help here: Error:User's image I tried running Get-AzADGroup but same error: User's image

Group in AD: User's image

Thanks in advance!

Windows for business | Windows Server | User experience | PowerShell
Microsoft Security | Microsoft Entra | Microsoft Entra ID

Answer accepted by question author

dashanan13 940 Reputation points
2024-02-17T08:43:15.33+00:00

Hei @Apurva Pathak , Thank for contacting Microsoft Q&A. This seems like a context issue and as suggested by @Julian Sperling above, you may want to check context and set correct context before executing the command. It should go about such:

  1. Login with correct credentials: Connect-AzAccount
    (this will make sure you are logged in with correct credentials on correct tenant etc)
  2. Check Azure Context: Get-Azcontext
  3. Set Azure Context: Set-AzContext -Subscription "xxxx-xxxx-xxxx-xxxx"
  4. (output should be name etc of the subscription set)
  5. Execute the command and check if it still fails

If this helped, do mark this as answer

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.