Forum Discussion
Han Valk
Jul 14, 2017Copper Contributor
Azure AD PowerShell v2 cmdlets not working, e.g. Get-AzureADPolicy
Sorry if I posted this twice, to me it seems that the first post did not succeed.
Installed PowerShellGet using the MSI.
Installed the Azure AD PowerShell v2 GA module using Install-Module AzureAD.
Connected and authenticated to our Azure AD tenant successfuly using Connect-AzureAD as can be seen below.
PS C:\Users\Administrator> connect-azuread
Account Environment TenantId TenantDomain AccountType
------- ----------- -------- ------------ -----------
xxxxxxx@xxxxxxxx.nl AzureCloud xxxxxxxx-0599-4cd4-8... xxxxxxxx.onmicrosof... User
But when running the Get-AzureADPolicy I get the error that this cmdlet is not available as can be seen below.
PS C:\Users\Administrator> Get-AzureADPolicy
Get-AzureADPolicy : The term 'Get-AzureADPolicy' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-AzureADPolicy
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzureADPolicy:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
What am I doing wrong?
I urgently need to adjust the token lifetimes.
15 Replies
Sort By
- BenoittCopper Contributor
At the moment I have the same issue.
I tried multiple version of AzureADPreview, removing AzureAD module and many other combinations but the command is still not found.
Related issue: https://github.com/Azure/CloudShell/issues/111
- Satish_Babu_DasariCopper Contributor
Benoitt Use below command and it works
Install-Module -Name AzureADPreview -AllowClobber
and run Import-Module Azureadpreview before running policy commands
- UdaiCopper Contributor
First uninstall using
UnInstall-Module AzureAD
then install the preview module
Install-Module AzureADPreview
- Thom McKiernanCopper Contributor
This worked for me. I had a new Win10 laptop and installing the preview (v2.0.2.5) would work but Get-AzureADPolicy didn't.
I just had to run "UnInstall-Module AzureAD" in a fresh elevated PowerShell console and then the preview cmdlets worked perfectly
- Jamey SteinmannCopper Contributor
This worked. Installing the AzureADPreview module was failing as there were too many conflicting commands with the AzureAD Module. Once I uninstalled AzureAD and then Installed AzureADPreview (latest version 2.0.1.11) then everything worked as expected. Thank you
- Steve RackhamCopper Contributor
Having same issue. If I import the AzureADPreview module only the same thing occurs, so its loading the AzureAD module in the background. You should be able to run both side by side for production.
Not happy.
- Doyle SpenceCopper Contributor
I have the same issue. The AzureADPreview module was working fine with 2.0.0.9 (I think that was the version) but updated to 2.0.11 I get the same experience. If I run Install-Module AzureADPreview, then run Connect-AzureAD, it loads AzureAD module and the Preview cmdlets can't be found... I can't run Preview cmdlets anymore.
- Han ValkCopper ContributorOk so I found out that I need to install the Azure AD PowerShell v2 preview module which I did. Unfortunately I still get the error that the Get-AzureADPolicy cmdlet is not recognized. I can use tab completion on Get-AzureADP and also Get-Help Get-AzureADPolicy is working.
Which version of the Preview module you have, works fine here with 2.0.0.127. Make sure you are actually loading the correct module, as when you have matching cmdlets between both (Connect-AzureAD is the same for AzureADPreview and AzureADPreview). For example, open a fresh PowerShell window, do a Import-Module AzureADPreview, connect and then try running Get-AzureADPolicy.
- rshah25Copper Contributor
Hi Vasil,
when i am setting up for mapping policy on my Machin,
Somehow after all install module below is still not working - i am using with 2.0.2.129 AzureADPreview
Get-AzureADPolicy is not recognized as the nameof a cmdlet.........