Azure / azure-dev

A developer CLI that reduces the time it takes for you to get started on Azure. The Azure Developer CLI (azd) provides a set of developer-friendly commands that map to key stages in your workflow - code, build, deploy, monitor, repeat.
https://aka.ms/azd
MIT License
402 stars 195 forks source link

Reserved resource name errors - need a workaround #2644

Open savannahostrowski opened 1 year ago

savannahostrowski commented 1 year ago

If a repo contains a reserved name, we currently throw this error: image

The issue here is "microsoft". Sample app: https://github.com/OfficeDev/microsoft-teams-apps-champion-management

savannahostrowski commented 1 year ago

Discovered while testing #705 but relevant regardless of the situation

savannahostrowski commented 1 year ago

@rajeshkamal5050 @ellismg any thoughts here?

rajeshkamal5050 commented 1 year ago

@rajeshkamal5050 @ellismg any thoughts here?

Do you think we can capture ReservedResourceName error as part of the troubleshooting docs to refer here - https://learn.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/error-reserved-resource-name#cause so users know which part of the name is causing it?

savannahostrowski commented 1 year ago

IMO, we shouldn't have to ask people to rename their repos. That's sort of a tall ask.

rajeshkamal5050 commented 1 year ago

IMO, we shouldn't have to ask people to rename their repos. That's sort of a tall ask.

Don't think they need to rename repo. It seems to be caused due to a specific IaC resource which they are trying to provision contains name with microsoft in it. Must be defined somewhere in their IaC files. Seems the error is coming from ARM and not in Azd

Why do you think its caused due to the repo naming?

savannahostrowski commented 1 year ago

I ran into this using the new simplified init flow so perhaps we need to consider this in the IaC we are generating.

savannahostrowski commented 1 year ago

cc: @weikanglim

weikanglim commented 1 year ago

Simplified init uses directory names as the defaults to things like: service name, project name.

We could update the default naming scheme to handle these reserved names as an added line of defense.

Personally, the autogenerated names may not always be what users want either way. And renaming the names should be something worth considering by most users.

This is currently accomplished by the following:

  1. Update the name in azure.yaml
  2. Ctrl + F in VSCode for azd-service-name and update accordingly

That should be all that is needed.