【问题标题】:Azure policy is not working for Azure Virtual machineAzure 策略不适用于 Azure 虚拟机
【发布时间】:2019-10-15 04:46:02
【问题描述】:

我创建了一个策略定义,以便在 Windows 机器上安装 Microsoft Antimalware 扩展。 当我转到 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。

【问题讨论】:

    标签: azure-virtual-machine azure-policy


    【解决方案1】:

    答案很简单。查看 SKU、Image Offer 和 Publisher 的策略定义与我正在创建和部署的 VM 无关,因此我无法在“扩展”选项卡中看到它。

    我更新了规则 JSON 文件并创建了新定义和后续分配。此后创建的所有虚拟机都安装了扩展。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-25
      • 2013-08-20
      相关资源
      最近更新 更多