Search code examples
azureazure-active-directoryazure-powershell

how can i retrieve all conditional access policies AzureAD?


I'm working on a pipeline that retrieves all conditional access policies from Azure active directory and make an csv list

my problem is that I found a command get-azureadmsconditionalaccesspolicy that lists them but it's not showing all the policies that exists does anyone know how to solve it ?

thank you in advance


Solution

  • I tried to reproduce the same in my environment to get the Azure Conditional Access policy using PowerShell

    I have created 2 conditional access policies like below.

    enter image description here

    In order to use GetAzureADMSConditionalAccessPolicy command, first you have to install required version of PowerShell module to get all policies using PowerShell.

    Here is the PowerShell command to know the required version of PowerShell module.

    Get-command *conditional*
    

    enter image description here

    I have installed both the versions

    Install-Module -Name AzureAD -RequiredVersion 2.0.2.140
    Install-Module -Name AzureADPreview -RequiredVersion 2.0.2.149
    

    Connect to Azure AD

    Connect-AzureAD
    

    Get all Azure Conditional Access policies

    Get-AzureADMSConditionalAccessPolicy 
    

    enter image description here

    Get Azure conditional Access policies with filter conditions

    Get-AzureADMSConditionalAccessPolicy|FT DisplayName,Id
    

    enter image description here