1
votes

I run web app in azure app service, where I need to get Authenticated Users(via Azure AD) Password Expiry Details.

How to get password policy for Azure Active Directory logged in user

I follow above answer and I got it working on Local visual studio.

However Now this code is deployed on Azure App Service and it throws. "Connect-MsolService" is not defined cmdlet...

When I got this error on local, it was because Azure AD Powershell module requires to be run on 64 bit environment. So I checked following checkbox in Visual Studio Tools->Options->Projects & Solutions->Web Projects->Use 64 bit version of IIS Express.. That was it and it worked on local.

As it needs 64 bit. I have also checked Azure Web App->Application Settings->Platform to 64bit (Default is 32 bit)

Still the same error of "Unknown cmdlet"

Anyone experienced this before.

1
Are you sure that the Azure AD powershell module is installed on the app service machines? You may want to take a look at the Azure AD Graph API for a way to access Azure AD without having any pre-requisites installed.RasmusW
unfortunately, Azure AD Graph API does not yet have capability to return LastPasswordChangedDate. How do I install powershell module on the app service machines?Mandar Jogalekar

1 Answers

2
votes

The Azure App Service doesn't install the corresponding PowerShell command-lets. If you want to deploy the service to Azure, you need to choose Cloud Service or Virtual Machine to enable install the required PowerShell on the Azure environment.

More detail about the difference, you can refer below link:

Should I choose cloud services or something else?