Last active
July 8, 2021 07:20
-
-
Save PsychoData/27c5028a5a78237f9910d4f652f6b269 to your computer and use it in GitHub Desktop.
Boot Diagnostics - DeployIfNotExist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"mode": "All", | |
"policyRule": { | |
"if": { | |
"allOf": [ | |
{ | |
"field": "type", | |
"equals": "Microsoft.Compute/virtualMachines" | |
}, | |
{ | |
"field": "tags", | |
"notContains": "IgnoreBootDiagnostics" | |
}, | |
{ | |
"field": "Microsoft.Compute/virtualMachines/diagnosticsProfile.bootDiagnostics.storageUri", | |
"notContains": "[parameters('StorageURI')]" | |
}, | |
{ | |
"not": { | |
"field": "Microsoft.Compute/virtualMachines/diagnosticsProfile.bootDiagnostics.storageUri", | |
"equals": "" | |
} | |
} | |
] | |
}, | |
"then": { | |
"effect": "modify", | |
"details": { | |
"roleDefinitionIds": [ | |
"/providers/Microsoft.Authorization/roleDefinitions/9980e02c-c2be-4d73-94e8-173b1dc7cf3c" | |
], | |
"conflictEffect": "audit", | |
"operations": [ | |
{ | |
"operation": "addOrReplace", | |
"field": "Microsoft.Compute/virtualMachines/diagnosticsProfile.bootDiagnostics.storageUri", | |
"value": "[parameters('StorageURI')]" | |
}, | |
{ | |
"operation": "addOrReplace", | |
"field": "Microsoft.Compute/virtualMachines/diagnosticsProfile.bootDiagnostics.enabled", | |
"value": true | |
} | |
] | |
} | |
} | |
}, | |
"parameters": { | |
"StorageURI": { | |
"type": "String", | |
"metadata": { | |
"displayName": "StorageURI", | |
"description": "Storage Account that will be applied to any account that does not already have one applied." | |
}, | |
"defaultValue": "https://YourBlobStorage.blob.core.windows.net" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment