Azure / azure-policy

Repository for Azure Resource Policy built-in definitions and samples
MIT License
1.48k stars 1.08k forks source link

Policy to deny ahub in Vms #1144

Open ghost opened 1 year ago

ghost commented 1 year ago

Need help with this policy

https://github.com/Azure/azure-policy/blob/master/samples/Compute/deny-hybrid-use-benefit/azurepolicy.json

This policy deny ahub in Azure Vms, i need to deny in azure sql db, azure sql elastic pool, azure sql vm too You guys can help me in this case? I'll apply this policy in a MSDN subscriptions management group.

ghost commented 1 year ago

I need to deny windows 10, 11 too

SvenSowa commented 1 year ago

I need to deny windows 10, 11 too

instead of { "field": "Microsoft.Compute/licenseType", "equals": "Windows_Server" }

you could use { "field": "Microsoft.Compute/licenseType", "in": ["Windows_Client","Windows_Server"] }

ghost commented 1 year ago

This policy works, but when I need to resize VM, this policy deny the resize. I can the adjust this policy to deny only ahub and allow others actions?