我创建了一个策略定义,以便在Windows机器上安装Microsoft反病毒扩展。当我转到VM >扩展时,没有扩展名:

但是,当我转到VM > Policies并选择适当的策略时,我没有看到这个VM?

我执行了以下两个命令来创建定义和分配策略。
定义:
az policy definition create --name 'Microsoft-Antimalware-extension-windows-server' --display-name 'Deploy default Microsoft IaaSAntimalware extension for Windows Server' --description 'This policy deploys a Microsoft IaaSAntimalware extension with a default configuraion when a VM is not configured with the antimalware extension.' --rules 'https://raw.githubusercontent.com/Azure/azure-policy/master/samples/built-in-policy/deploy-default-antimalware-extension-for-windows-server/azurepolicy.rules.json' --params 'https://raw.githubusercontent.com/Azure/azure-policy/master/samples/built-in-policy/deploy-default-antimalware-extension-for-windows-server/azurepolicy.parameters.json' --mode All赋值:
az policy assignment create --scope /subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxx --policy "Microsoft-Antimalware-extension-windows-server" 另外,注意,在定义策略并将其分配给订阅之后,我手动创建了VM。
发布于 2019-10-15 13:00:23
答案很简单。查看策略定义-- SKU、Image和Publisher --与我正在创建和部署的VM无关,因此我无法在“扩展”选项卡中看到它。
我更新了规则JSON文件,并创建了一个新的定义和相应的赋值。此后创建的所有VM都安装了扩展。
https://stackoverflow.com/questions/58387407
复制相似问题