Azure Automation PowerShell - While trying to connect to AzureAD using 'Connect-AzureAD' it give me issue of cmdlet not recognized.

Rituparna Khatua 0 Reputation points
2024-07-08T01:54:06.11+00:00

I am trying to get all the users in AD using PowerShell automation runbook.
The modules are installed in the shared resources.

User's image

Still when executing line : 'Connect-AzureAD' throws error of :
User's image

I have tried options like :

  1. Importing the modules AzureAD and Az implicitly.
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Abiola Akinbade 30,450 Reputation points Volunteer Moderator
    2024-07-08T05:29:56.45+00:00

    Hello Rituparna Khatua,

    Thanks for your question

    It is recommended to use Microsoft Graph. Below is asample script for your reference on how to connect to Azure AD using Microsoft Graph v1 and v2. Ref :

    https://gist.github.com/AlexFilipin/daace2f2d7989545e8ab0b969de2aaed

    Regards,

    Abiola

    You can mark it 'Accept Answer' if this helped.

    0 comments No comments

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.