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.
1,263 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,620 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. akinbade abiola 18,715 Reputation points
    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 Answers by the question author, which helps users to know the answer solved the author's problem.