To create diagnostic settings on an Azure Firewall I want to pass in logs and metrics settings.
I define these in 2 variables and then pass 'em into Azure CLI:
$logsSetting = "[{'category': 'AzureFirewallApplicationRule','enabled': true,'retentionPolicy': {'days': 0,'enabled': false}},{'category': 'AzureFirewallNetworkRule','enabled': true,'retentionPolicy': {'days': 0,'enabled': false}}]"
$metricsSetting = "[{'category': 'AllMetrics','enabled': true,'retentionPolicy': {'days': 0,'enabled': false},'timeGrain': null}]"
az monitor diagnostic-settings create --name $FW_NAME `
--resource $FW_NAME -g $VNET_GROUP --resource-type Microsoft.Network/azureFirewalls `
--resource-group $VNET_GROUP `
--workspace $FW_NAME `
--logs $logsSetting `
--metrics $metricsSetting
Executing this I get Expecting property name enclosed in double quotes: line 1 column 3 (char 2)
.
I tried without success
- changed from multiline string literal to single line (which caused another error)
- replaced
'
with"