使用Azure App Service中的Powershell命令连接到Azure AD [英] Connect to Azure AD using Powershell commands from Azure App Service
问题描述
我在azure应用程序服务中运行Web应用程序,我需要在该服务中获取经过身份验证的用户(通过Azure AD)密码到期详细信息.
I run web app in azure app service, where I need to get Authenticated Users(via Azure AD) Password Expiry Details.
我遵循以上答案,并在Local visual studio上工作.
I follow above answer and I got it working on Local visual studio.
但是,现在此代码已部署在Azure App Service上并引发. 未定义"Connect-MsolService" cmdlet ...
However Now this code is deployed on Azure App Service and it throws. "Connect-MsolService" is not defined cmdlet...
当我在本地遇到此错误时,是因为Azure AD Powershell模块需要在64位环境上运行.因此,我在Visual Studio工具->选项->项目&中选中了以下复选框解决方案-> Web项目->使用IIS Express的64位版本.就是这样,它可以在本地使用.
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.
因为它需要64位.我还检查了Azure Web App->应用程序设置->平台到64位(默认为32位)
As it needs 64 bit. I have also checked Azure Web App->Application Settings->Platform to 64bit (Default is 32 bit)
仍然与未知cmdlet"相同的错误
Still the same error of "Unknown cmdlet"
任何人以前都经历过.
推荐答案
Azure App Service不会安装相应的PowerShell命令集.如果要将服务部署到Azure,则需要选择云服务"或虚拟机"以启用在Azure环境上安装所需的PowerShell.
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:
这篇关于使用Azure App Service中的Powershell命令连接到Azure AD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!