我们正在按照 Microsoft Azure 的文档在 Azure 云中创建 Azure 堆栈。
我们被困在这个文档中:https ://docs.microsoft.com/en-us/azure/azure-stack/azure-stack-policy-module
在此标题:将策略应用于资源组
$resourceGroupName = ‘myRG01’
$s = Select-AzureRmSubscription -SubscriptionName "<Azure Subscription Name>"
$policy = New-AzureRmPolicyDefinition -Name AzureStackPolicyDefinition -Policy (**Get-AzureStackRmPolicy**)
New-AzureRmPolicyAssignment -Name AzureStack -PolicyDefinition $policy -Scope /subscriptions/$subscriptionID/resourceGroups/$rgName
当我们运行上面的 PowerShell 脚本时,我们观察到下面提到的错误:
Get-AzureStackRmPolicy : The term 'Get-AzureStackRmPolicy' 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:2 char:81
+ ... ion -Name AzureStackPolicyDefinition -Policy (Get-AzureStackRmPolicy)
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AzureStackRmPolicy:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException