az feedback auto-generates most of the information requested below, as of CLI version 2.0.62
Describe the bug
When passing JSON to CLI, an error occurs:
az : Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
To Reproduce
PS C:\Users\msmall.NORTHAMERICA> az monitor diagnostic-settings create -n "msmall-01"
--resource "/subscriptions//resourceGroups/SME/providers/Microsoft.DocumentDB/databaseAccounts/msmall" --event-hub "msmall"
--event-hub-rule "/subscriptions//resourceGroups/Main/providers/Microsoft.EventHub/namespaces/msmall/AuthorizationRules/RootManageSharedAccessKey" --storage-account "/subscriptions<subscriptionid>/resourceGroups/Main/providers/Microsoft.Storage/storageAccounts/dbvulnerability"
--logs '{"category":"QueryRuntimeStatistics","enabled":"true","retentionPolicy":{"days":"6","enabled":"true"}}'
Expected behavior
Command returns as expected
Environment summary
az --version
azure-cli 2.21.0
core 2.21.0
telemetry 1.0.6
Extensions:
resource-graph 1.0.0
Python (Windows) 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 23 2018, 23:31:17) [MSC v.1916 32 bit (Intel)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context
Issue is resolved by escaping the double quotes in the JSON:
--logs '[{"category":"QueryRuntimeStatistics","enabled":"true","retentionPolicy":{"days":"6","enabled":"true"}}]'
Describe the bug
When passing JSON to CLI, an error occurs:
az : Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
To Reproduce
PS C:\Users\msmall.NORTHAMERICA> az monitor diagnostic-settings create
-n "msmall-01"--resource "/subscriptions//resourceGroups/SME/providers/Microsoft.DocumentDB/databaseAccounts/msmall"
--event-hub "msmall"--event-hub-rule "/subscriptions//resourceGroups/Main/providers/Microsoft.EventHub/namespaces/msmall/AuthorizationRules/RootManageSharedAccessKey"
--storage-account "/subscriptions<subscriptionid>/resourceGroups/Main/providers/Microsoft.Storage/storageAccounts/dbvulnerability"--logs '{"category":"QueryRuntimeStatistics","enabled":"true","retentionPolicy":{"days":"6","enabled":"true"}}'
Expected behavior
Command returns as expected
Environment summary
az --version
azure-cli 2.21.0
core 2.21.0
telemetry 1.0.6
Extensions:
resource-graph 1.0.0
Python (Windows) 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 23 2018, 23:31:17) [MSC v.1916 32 bit (Intel)]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context
Issue is resolved by escaping the double quotes in the JSON:
--logs '[{"category":"QueryRuntimeStatistics","enabled":"true","retentionPolicy":{"days":"6","enabled":"true"}}]'