Create Azure Resource Policy to enforce user? -
i looking option enforce user use specific image, trying modify below code use hub image
. below code trying modify enforce windows hub
"if": { "allof": [ { "field": "type", "in": [ "microsoft.compute/virtualmachines", "microsoft.compute/virtualmachinescalesets" ] }, { "field": "microsoft.compute/licensetype", "exists": windows_server } ] }, "then": { "effect": "deny" }
} }
if understanding right, firstly find hub images's sku.
for windows server:
ps c:\program files\> get-azurermvmimagesku -location westus -publishername microsoftwindowsserver -offer windowsserver-hub|select skus skus ---- 2008-r2-sp1-hub 2012-datacenter-hub 2012-r2-datacenter-hub 2016-datacenter-hub
for windows client:
ps c:\program files> get-azurermvmimagesku -location "west us" -publisher "microsoftwindowsserver" -offer "windows-hub"|select skus skus ---- windows-10-hub
more information please refer blog , link.
according official document. maybe modify policy below:
{ "if":{ { "anyof": [ { "field": "microsoft.compute/imagesku", "like": "2016-datacenter-hub*" }, { "field": "microsoft.compute/imagesku", "like": "windows-10-hub*" }, { ..... } ] } }, "then": { "effect": "deny" } }
Comments
Post a Comment