I have a requirement to create a AZ CLI script to create a few resources and I would like to make it idempotent in a way that it checks if a resource exists before tries creating it.
The is what I have for creating an action group but my question is for checking any resource to see if it exists.
az monitor action-group create `
--name $ActionGroupName `
--resource-group $ResourceGroupName `
--short-name $AGShortName
The below will throw error if the resource does not exist. How can I safely check if a resource exists?
az monitor action-group show `
--name $ActionGroupName `
--resource-group $ResourceGroupName `