Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3k forks source link

Link in error not up-to-date #10324

Open ashemedai opened 5 years ago

ashemedai commented 5 years ago

Describe the bug

This most likely needs to handed to the ARM team, but I am unsure how they overlap with the azure cli work, please forward as needed.

Command Name az deployment create

Errors:

Deployment failed. Correlation ID: 95a24e5e-4d7e-4129-922d-70a63696401c. {
  "error": {
    "code": "InvalidTemplate",
    "message": "Unable to process template language expressions for resource '/subscriptions/588353ce-6a56-430a-9384-d5f273c42d74/resourceGroups/development-rg/providers/Microsoft.Resources/deployments/common-infrastructure-development' at line '1' and column '1508'. 'Unable to evaluate template language function 'resourceId': the type 'Microsoft.Network/virtualNetworks' requires '1' resource name argument(s). Please see https://aka.ms/arm-template-expressions/#resourceid for usage details.'",
    "additionalInfo": [
      {
        "type": "TemplateViolation",
        "info": {
          "lineNumber": 1,
          "positionNumber": 1508,
          "snippet": ""
        }
      }
    ]
  }
}

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

Create a template containing something like:

"sourceAddressPrefix": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('nsgDatabaseName'))]"

On deployment ARM returns with the error above. Going to https://aka.ms/arm-template-expressions/#resourceid expands to https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions#resourceid and drops us at the very top of the resource functions.

Expected Behavior

Expected a direct anchor link to resourceId(), namely https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions-resource#resourceid

Environment Summary

Darwin-18.7.0-x86_64-i386-64bit
Python 3.7.4
Shell: bash

azure-cli 2.0.71

Additional Context

Most likely more URLs are in need for adjustments.

ghost commented 5 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure

alex-frankel commented 5 years ago

@tfitzmac - I think we just need to update the link to this: https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions-resource#resourceid

Do you have ownership of that aka link?

tfitzmac commented 5 years ago

No, I don't own that aka link.

@lpavel - are you able to change the link in the error message to go to the link from @alex-frankel ?

alex-frankel commented 4 years ago

can this issue be assigned to @lpavel? Or @lpavel can you assign ownership of the link to @tfitzmac?

snaheth commented 4 years ago

The aka.ms/arm-template-expressions link is surfaced in other error responses so I don't think changing the forwarding URL is the right change here.

I'm following up with Laurentiu to see if there's a separate aka.ms link for the Resources page so we can use that.

tfitzmac commented 4 years ago

We could try adding a redirect in the docs that includes the anchor value. I am not sure how that would be handled because the page itself is valid so we don't want to redirect all requests.

snaheth commented 3 years ago

@anthony-c-martin @alex-frankel -- Should we make this change in the CLI repo (in the az deployment create call)?

ashemedai commented 2 years ago

Shall I close this since it seems to be a difficult change.

tfitzmac commented 2 years ago

We are reviewing all of the links in error messages and coming up with a list of changes. I think it makes sense to leave this open for now. Adding @davidsmatlak

davidsmatlak commented 2 years ago

The comment is correct that some links are used in multiple error code responses, and in those cases, it's best to link to an article rather than a specific section of an article. There's now a direct link to the resource functions article: https://aka.ms/arm-resource-functions. Based on this comment the Az CLI team needs to apply the fix in source code.