question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: validate resource type in resourceId() call

See original GitHub issue

I was pairing with @jorgecotillo on some ARM templates, and we were using this ARM output parameter:

"outputs": {
    "pcf-subnet-nsg-id": {
      "type": "string",
      "value": "[resourceId('Microsoft.Network/networkSecurityGrops', variables('pcf-nsg-name'))]"
    }
  }

There is a typo in the resource provider that was causing this error in ARM:

{
"code": "InvalidJsonReferenceFormat",
        "message": "Reference Id /subscriptions/cf0c53fb-06f5-4fe3-9c25-cabce6811cb1/resourceGroups/contoso-pcf-net-rg/providers/Microsoft.Network/networkSecurityGrops/pcf-nsg is not formatted correctly. The Id is expected to reference resources of type networkSecurityGroups. Path properties.subnets[0].properties.networkSecurityGroup."
}

It took us ~5-10 minutes to debug the issue because we missed the typo in the Resource Provider name. Once we fixed the typo, it resolved our issue.

By checking the validity of the Resource Provider that will help users be able to catch issues like ours much faster.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
StephenWeatherfordcommented, Jul 2, 2020

Common scenarios could be handled in the extension.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature request: validate resource type in resourceId() call #135
I was pairing with @jorgecotillo on some ARM templates, and we were using this ARM output parameter: "outputs": { "pcf-subnet-nsg-id": ...
Read more >
Get By Id - REST API (Azure Resource Management)
Learn more about Resource Management service - Gets a resource by ID. ... fully qualified ID of the resource, including the resource name...
Read more >
Resolve template validation or template format errors in ... - AWS
Confirm that resource logical IDs and parameters are defined in your template. In the following JSON and YAML templates, test is referenced for ......
Read more >
Improve code inspection with annotations - Android Developers
Validating resource types can be useful because Android references to ... The build tools will flag incorrect code that passes a color resource...
Read more >
Resource IDs - Smile CDR Documentation
In this mode, clients may not assign a resource ID. Attempts to write to a resource ID that does not already exist will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found