Azure-docs: "targetResourceType property is missing or invalid."

Created on 10 Jan 2019  Â·  11Comments  Â·  Source: MicrosoftDocs/azure-docs

When deploying an alert from an ARM template that monitors a single resource we are receiving the following error:
'{
"Code": "BadRequest",
"Message": "targetResourceType property is missing or invalid."
}'

It is my understanding that we only need to provide targetResourceType when monitoring multiple VMs. This seems to only happen on newer versions of Azure powershell. It work on another machine with Azure Powershell 5.1.1 but doesn't work on my machine (version 5.3.0) as well as Azure Devops pipelines


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Azure-Monitosvc assigned-to-author product-issue triaged

Most helpful comment

I've got a similar or the same issue (AzureRM.Resources module version is 6.7.3), it's reproducible in the following scenario: create an alert rule with an ARM template (single resource, single metric, specific entity for a dimension - Service Bus topic in my case) => modify that alert rule in the portal => deploy it again using ARM (with the same or different parameters), and you get the this error. Seems like something changes after the edit in the portal that prevents successful redeployment of the same alert rule.

All 11 comments

@nhart12 Thanks for the Comment. We are actively investigating and will get back to you soon.

@nhart12 , Yes, the 'targetResourceType' parameter is needed (mandatory) when monitoring multiple resources multiple metric criteria.

I have tested and tried to reproduce your issue but couldn't see any issue as "targetResourceType property is missing or invalid" while deploying an alert from an ARM template that monitors a single resource using various Azure PowerShell versions including 5.1.1, 5.3.0 and 6.7.0 as well. You can find the various tested scenarios and screenshots related to them in the attached document 'GT_22105.docx'.

Note that, if you use default agent pool in Azure DevOps pipeline and if you opt to use Azure PowerShell version 5.3.0 then the deployment is expected to fail as the 5.3.0 versioned module is not part of the default agent pool.

Hence, as you are hitting the issue of "targetResourceType property is missing or invalid" so the preferred approach is to double check your template if you have accidentally used targetResourceType property for single resource template unless you haven't already done this. Else as it is hard to say what is causing you to hit the issue of "targetResourceType property is missing or invalid", support would be able to determine this but unfortunately I can not so if you already have a support plan then here (https://docs.microsoft.com/en-us/azure/azure-supportability/how-to-create-azure-support-request) are the steps for you to raise a support ticket with Azure technical support. Else if you don't have a support plan then please send mail to [email protected] with your subscription ID and a link to this Github thread (for context) and we will assist you with engaging Azure technical support.

GT_22105.docx

On further digging, it seems to only error when deploying a metric alert trying to monitor a single cosmos db resource

@snehithm , any insights on this please? This might be related to https://github.com/MicrosoftDocs/azure-docs/issues/16061

Assigning to content owner for deeper review.

I've got a similar or the same issue (AzureRM.Resources module version is 6.7.3), it's reproducible in the following scenario: create an alert rule with an ARM template (single resource, single metric, specific entity for a dimension - Service Bus topic in my case) => modify that alert rule in the portal => deploy it again using ARM (with the same or different parameters), and you get the this error. Seems like something changes after the edit in the portal that prevents successful redeployment of the same alert rule.

@nhart12, could you share the ARM template and parameter files with me off-line at snmuvva AT Microsoft DOT com?

@snehithm I've sent the requested files

I am also seeing the same issue re-deploying an existing ARM template that monitors a Postgres instance. Deleting the alert seems to fix it but re-applying the alert on top of the existing alert throws this error.

Hi folks,

Thanks for providing the repro and sorry for the incovenience. We identified a bug which was causing this. We are working on a fix. I will keep you posted when the fix lands.

Regards,
Snehith

This issue is now fixed. If you are still seeing this issue please do let us know on [email protected]

Docs team, #please-close

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ianpowell2017 picture ianpowell2017  Â·  3Comments

spottedmahn picture spottedmahn  Â·  3Comments

Agazoth picture Agazoth  Â·  3Comments

AronT-TLV picture AronT-TLV  Â·  3Comments

monteledwards picture monteledwards  Â·  3Comments