5

I'm trying to get my Build Definition to deploy all necessary resources (SQL Server, DB, Web-app and storage account) to azure, and update in case of a redeploy. I use Visual Studio Team Services VSTS / TFS. The build step "Azure Resource Group Deployment", fails with error:

"code": "StorageAccountAlreadyExists",
"message": "The storage account named mystorageaccountname already exists under the subscription."

Well, it is true that the storage account mystorageaccountname already exists, but that is usual the case when trying to implement continuous delivery and redeploy. I want to reuse the existing accounts.

For other resource, like a SQL server and SQL database the pre-existence of the resource is not an issue.

How can I do a Azure Resource Group Deployment that can be used over and over again?

RHAD
  • 1,317
  • 3
  • 13
  • 37
  • Could you mind sharing the ARM template or the snipped of it? If there is `"tags":{ "displayName": "xxxxx" }` in the storage ARM template, please have a try to remove it and try it again. – Tom Sun - MSFT Jan 03 '17 at 03:31
  • @TomSun-MSFT's suggestion did not work for me. – Iain Mar 09 '17 at 02:21

5 Answers5

3

two possible properties to check is

  1. Location
  2. tags

If you are trying to deploy with conflicting tags or location this error will show

Kieran
  • 17,572
  • 7
  • 45
  • 53
  • 1
    I had this issue and it was due to mismatched tags. For some reason rather than the ARM deployment correcting the tags it behaves as if it wants to create the storage account as new. Manually fixing the tags to match what is defined in the template allowed the deployment to go through for me. – Mark Wragg Apr 30 '21 at 10:08
0

Check the name you have given to the storage account. It doesn't look like a valid one as it can't contain capital cases. Also, check that the existing storage you are referring to is not a 'classic' storage account (ASM) but an ARM.

More details here: https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-common-deployment-errors#storagenamenotunique

Regards, Carlos

Carlos B
  • 1
  • 1
  • The storageaccount is indeed an ARM account. I've had the account name name replaced to hide the original implementation name. The real name is lower case and I've changed the question to reflect lower case. I've read the documentation in the link. I understand the errorcode, but it seems to me that a redeploy must not result in this error. A informational message at the max, but not an error since it should be OK to run the script twice. – RHAD Dec 31 '16 at 18:33
0

Just had this same issue and it turned out that the azure cli was creating a Premium_LRS storage account by default, but our template deployment specified a Standard_LRS storage account. It wouldn't reuse the storage account because of the different type, thus resulting in a naming conflict.

You might be having a similar issue?

Sam
  • 1
  • 1
  • 2
0

I had the same issue for redeployment of StorageAccount and KeyVault resources to same ResourceGroup. This was because of the Property - "tags".

  // "tags": {
  //   "displayName": "storageAccount1"
  // },

When I commented the code (then deleted the code from ARM template), it worked properly on redeployment scenario. As it's add tag to the resource so Azure deployment doesn't allow to redeploy the same resource with same tag value. Because of this redeployment fails.

Ajit Medhekar
  • 1,018
  • 1
  • 10
  • 39
-1

Just had this same issue and it appeared to be that it was because the Resource Group that I wanted to create the server in was different to the resource group for the storage account.

Ian D
  • 1