Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a Storage Account with an existing name in the same region with a different sku is throwing an incorrect sku error #27899

Closed
calvinhzy opened this issue Nov 22, 2023 · 1 comment · Fixed by #27914
Assignees
Labels
Azure CLI Team The command of the issue is owned by Azure CLI team bug This issue requires a change to an existing behavior in the product in order to be resolved. Storage az storage

Comments

@calvinhzy
Copy link
Member

Describe the bug

In a discussion with the customer, he identified that when creating a storage account as LRS, after that if he tries to create the same storage account again but with a different SKU he receives the error below, however, the error he should receive should be [The storage account named "storageaccountname" is already taken.]

When trying to create the same storage account again with the same name in the same region, just change the SKU:

ERROR: cli.azure.cli.core.azclierror: (InvalidValuesForRequestParameters) Values for request parameters are invalid: sku.
Code: InvalidValuesForRequestParameters
Message: Values for request parameters are invalid: sku.

When trying to create the same storage account again with the same name in another region and changing the SKU:

ERROR: cli.azure.cli.core.azclierror: (InvalidResourceLocation) The resource 'asuracetestcona' already exists in location 'westeurope' in resource group 'adossa-dev-rg'. A resource with the same name cannot be created in location 'northeurope'. Please select a new resource name.
Code: InvalidResourceLocation
Message: The resource 'asuracetestcona' already exists in location 'westeurope' in resource group 'adosa-dev-rg'. A resource with the same name cannot be created in location 'northeurope'. Please select a new resource name.

All this behavior is possible and easy to reproduce (tested from my end and the same behavior) and is only reproducible with CLI, PowerShell correctly shows that correct error even changing the region of the account: The storage account named "storageaccountname" is already taken.

The customer is using cloud shell but I tried outside of cloud shell and we have the same behavior, even after more than 24 times of creating the account it continues to report the same error of "Values for request parameters are invalid: sku."

Attached I leave some logs that I collected with the customer, however, the error is easily reproducible with CLI.

raised by @ebrandao

Related command

az storage account create

Errors

ERROR: cli.azure.cli.core.azclierror: (InvalidValuesForRequestParameters) Values for request parameters are invalid: sku.
Code: InvalidValuesForRequestParameters
Message: Values for request parameters are invalid: sku.

Issue script & Debug output

debug-cli storage creation (1).txt

Expected behavior

It should show an error like this ERROR: cli.azure.cli.core.azclierror: (InvalidResourceLocation) The resource 'asuracetestcona' already exists in location 'westeurope' in resource group 'adossa-dev-rg'. A resource with the same name cannot be created in location 'westeurope'. Please select a new resource name.
Code: DuplicateResourceName

Environment Summary

azure-cli 2.54.0

Additional context

No response

@calvinhzy calvinhzy added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Nov 22, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Nov 22, 2023
@calvinhzy calvinhzy removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Auto-Assign Auto assign by bot Azure CLI Team The command of the issue is owned by Azure CLI team labels Nov 22, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Nov 22, 2023

Storage bug fix

@calvinhzy calvinhzy changed the title Creating a Storage Account with an existing name in the same region a different sku is throwing an incorrect sku error Creating a Storage Account with an existing name in the same region with a different sku is throwing an incorrect sku error Nov 22, 2023
@yonzhan yonzhan added the Azure CLI Team The command of the issue is owned by Azure CLI team label Nov 22, 2023
@yonzhan yonzhan added this to the November 2023 (2023-12-05) milestone Nov 22, 2023
Greedygre pushed a commit to Greedygre/azure-cli that referenced this issue Nov 28, 2023
…me_availability()` first and throw a warning when an existing account with the name is found (Azure#27914)

* run check_name_availability before trying to create the storage account and throw a warning that update will be run if a storage account with the same name already exists. In the future, an error will be thrown instead.

* Rerun tests from instance 3. See test_results_None_latest_3.serial.xml for details

* Rerun tests from instance 7. See test_results_None_latest_7.parallel.xml for details

* Rerun tests from instance 4. See test_results_None_latest_4.parallel.xml for details

* Rerun tests from instance 6. See test_results_None_latest_6.parallel.xml for details

* lint

* fix recordings by adding new call to checkNameAvailability

* rerun for older profiles

* fix sharedKey credscan

* lint

* Update src/azure-cli/azure/cli/command_modules/storage/operations/account.py

Change warning to avoid confusion.

Co-authored-by: Yishi Wang <yishiwang@microsoft.com>

* lint

---------

Co-authored-by: Azure CLI Team <AzPyCLI@microsoft.com>
Co-authored-by: Yishi Wang <yishiwang@microsoft.com>
albertofori pushed a commit to albertofori/azure-cli that referenced this issue Dec 14, 2023
…me_availability()` first and throw a warning when an existing account with the name is found (Azure#27914)

* run check_name_availability before trying to create the storage account and throw a warning that update will be run if a storage account with the same name already exists. In the future, an error will be thrown instead.

* Rerun tests from instance 3. See test_results_None_latest_3.serial.xml for details

* Rerun tests from instance 7. See test_results_None_latest_7.parallel.xml for details

* Rerun tests from instance 4. See test_results_None_latest_4.parallel.xml for details

* Rerun tests from instance 6. See test_results_None_latest_6.parallel.xml for details

* lint

* fix recordings by adding new call to checkNameAvailability

* rerun for older profiles

* fix sharedKey credscan

* lint

* Update src/azure-cli/azure/cli/command_modules/storage/operations/account.py

Change warning to avoid confusion.

Co-authored-by: Yishi Wang <yishiwang@microsoft.com>

* lint

---------

Co-authored-by: Azure CLI Team <AzPyCLI@microsoft.com>
Co-authored-by: Yishi Wang <yishiwang@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure CLI Team The command of the issue is owned by Azure CLI team bug This issue requires a change to an existing behavior in the product in order to be resolved. Storage az storage
Projects
None yet
3 participants