5

After connecting to Azure AD with Connect-AzureAD , If run the command Get-AzureADPolicy, PowerShell is prompting the message as "Get-AzureADPolicy : The term 'Get-AzureADPolicy' is not recognized"

Aman Sharma
  • 1,930
  • 1
  • 17
  • 31
Ravikiran Reddy Kotapati
  • 2,485
  • 3
  • 22
  • 27

3 Answers3

13
  1. First Disconnect-AzureAD from the logged-in session
  2. Second UnInstall-Module AzureAD
  3. Third Install-Module AzureADPreview
  4. Forth connect-AzureAD Then try Get-AzureADPolicy

This will work

Ravikiran Reddy Kotapati
  • 2,485
  • 3
  • 22
  • 27
  • 2
    It's a mystery why the general availability version doesn't include the command that has been in preview for the same release version and is included in the documentation for the release version. – Captain Dashenka Nov 22 '19 at 08:16
  • when i tried to uninstall it told me azureAD was in use. I just closed and reopened powershell (as admin) and then uninstall worked fine. – fei0x Jun 14 '21 at 17:19
3
Install-Module AzureADPreview

failed to install at first. Then I have installed AzureAD:

Install-Module AzureAD

The Get-AzureADPolicy was still missing, so I tried to install AzureADPreview again (without removing AzureAD).

Install-Module AzureADPreview

This time it proceeded where it has failed previously. Adding the -AllowClobber argument fixed the installation problem.

Install-Module AzureADPreview -AllowClobber

Restarted Powershell and Get-AzureADPolicy worked.

Zsolti
  • 1,571
  • 1
  • 11
  • 22
0

for some reason after installing the module didn't import automatically. After the import-module AzureADPreview it worked for me