术语 'Register-AzResourceProvider' 未被识别为 cmdlet 的名称
The term 'Register-AzResourceProvider' is not recognized as the name of a cmdlet
您好,我正在尝试自学 Azure,我正在遵循本指南:https://docs.microsoft.com/en-us/learn/modules/intro-to-governance/2-azure-policy。我在 windows 10 和 $PSVersionTable.PSEdition
= Desktop
我给微软支持发了消息,但没有人回应。当我尝试 运行
# Register the resource provider if it's not already registered
Register-AzResourceProvider -ProviderNamespace 'Microsoft.PolicyInsights'
我明白了
Register-AzResourceProvider : The term 'Register-AzResourceProvider' 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.
我已检查是否安装了 Azure powershell
if ($PSVersionTable.PSEdition -eq 'Desktop' -and (Get-Module -Name AzureRM -ListAvailable)) {
Write-Warning -Message ('Az module not installed. Having both the AzureRM and ' +
'Az modules installed at the same time is not supported.')
} else {
Install-Module -Name Az -AllowClobber -Scope CurrentUser
}
如有任何帮助,我们将不胜感激。
要解决此问题,请尝试按照以下步骤操作。
1.Open 通过 Run as administrator
的新 powershell 会话,然后 运行 下面的命令。
Install-Module -Name Az -AllowClobber -Scope AllUsers -Force
2.After 安装模块,关闭管理员会话并打开一个新的普通 powershell 会话,然后登录您有权注册提供商的用户帐户,例如Owner
的订阅。
Connect-AzAccount
3.Then 注册提供商。
Register-AzResourceProvider -ProviderNamespace 'Microsoft.PolicyInsights'
注意:如果问题仍然存在,使用Get-Module
检查Az.Resources
模块是否导入到这个powershell会话中(通常会自动导入),如果没有,您可以使用 Import-Module -Name Az.Resources -Force
手动导入它。
您好,我正在尝试自学 Azure,我正在遵循本指南:https://docs.microsoft.com/en-us/learn/modules/intro-to-governance/2-azure-policy。我在 windows 10 和 $PSVersionTable.PSEdition
= Desktop
我给微软支持发了消息,但没有人回应。当我尝试 运行
# Register the resource provider if it's not already registered
Register-AzResourceProvider -ProviderNamespace 'Microsoft.PolicyInsights'
我明白了
Register-AzResourceProvider : The term 'Register-AzResourceProvider' 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.
我已检查是否安装了 Azure powershell
if ($PSVersionTable.PSEdition -eq 'Desktop' -and (Get-Module -Name AzureRM -ListAvailable)) {
Write-Warning -Message ('Az module not installed. Having both the AzureRM and ' +
'Az modules installed at the same time is not supported.')
} else {
Install-Module -Name Az -AllowClobber -Scope CurrentUser
}
如有任何帮助,我们将不胜感激。
要解决此问题,请尝试按照以下步骤操作。
1.Open 通过 Run as administrator
的新 powershell 会话,然后 运行 下面的命令。
Install-Module -Name Az -AllowClobber -Scope AllUsers -Force
2.After 安装模块,关闭管理员会话并打开一个新的普通 powershell 会话,然后登录您有权注册提供商的用户帐户,例如Owner
的订阅。
Connect-AzAccount
3.Then 注册提供商。
Register-AzResourceProvider -ProviderNamespace 'Microsoft.PolicyInsights'
注意:如果问题仍然存在,使用Get-Module
检查Az.Resources
模块是否导入到这个powershell会话中(通常会自动导入),如果没有,您可以使用 Import-Module -Name Az.Resources -Force
手动导入它。