Azure / ng-deploy-azure

Deploy Angular apps to Azure using the Angular CLI
MIT License
79 stars 37 forks source link

Storage Account Name Conflict #93

Open idg-sam opened 4 years ago

idg-sam commented 4 years ago

Describe the bug ng add @azure/ng-deploy automatically chooses a storage account name based on the project name when the user initializes it and signs in. Sometimes, that storage account name can conflict with an existing storage account (the name must be globally unique).

Initialization does not immediately make the user aware that they do not own the storage account in question, and the init fails silently. The user is told:

Account {{StorageAccountName}} already exist on subscription, using existing account.

In my case, the storage account name in question was not mine (and not in any of my subscriptions). I am working from an existing code sample.

When the user attempts to deploy the application (ng deploy), the following error is displayed:

The resource 'Microsoft.Storage/storageAccounts/{{StorageAccountName}}' under resource group '{{ResourceGroup}}' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix

To Reproduce

Steps to reproduce the behavior:

  1. Choose a project name that causes a conflict with an existing storage account name. For example, name your project angular9-todo-app, so that initializing ng-deploy will set it up to connect to the existing storage account angular9todoappstatic. Make sure that storage account is not owned/accessible by you.

  2. add ng-deploy with ng add @azure/ng-deploy

  3. sign in

  4. (storage account and other dependencies are created automatically)

  5. ✔ Creating resource group {{ResourceGroup}} at West US (westus) Account {{StorageAccountName}} already exist on subscription, using existing account CREATE azure.json (410 bytes) UPDATE angular.json (5475 bytes

  6. Deploy the app with ng deploy

  7. Preparing for deployment Error when trying to deploy: The Resource 'Microsoft.Storage/{{StorageAccountName}}' under resource group '{{ResourceGroup}}' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix

Expected behavior Either of the following behaviours would be nice:

  1. create a storage account with a unique name, e.g., a UUID so there are no conflicts
  2. To fail clearly at the initialization stage, when ng-deploy is added and the user signs in.

Desktop (please complete the following information):

Additional context N/A