/AzureAd-PowerShell-In-Ado-Pipelines

Using the AzureAd PowerShell module in Azure DevOps Pipelines

Primary LanguagePowerShellMIT LicenseMIT

AzureAd-PowerShell-In-Ado-Pipelines

Using the AzureAd PowerShell module in Azure DevOps Pipelines as part of an Azure PowerShell task

If you want to the Azure Active Directory PowerShell for Graph module (AzureAD) functionality in an Azure DevOps Pipeline as part of an Azure PowerShell task, you will notice that the AzureAD module is not available. Furthermore, depending if you are using Windows or Linux based Microsoft-hosted Azure pipeline agents, you will be using PowerShell or PowerShell Core.

At the time of writing this, AzureAD only works with PowerShell as it is dependent on the full .NET framework. Whilst there's no PowerShell Core supported version of AzureAD in the PowerShell Gallery, there is a private preview version available in the Posh Test Gallery. Whilst this is a gallery for testing purposes, this preview version of the module is already in use in the Azure Cloud Shell

The script in this repository can be used as part of the Azure PowerShell Task to determine the running version of PowerShell and install the compatible version of the Azure Active Directory PowerShell for Graph module.

A lot of the insights shared here came from the post How to use the AzureAD module in PowerShell Core by James Broome.