Build is failing while deplpoying through CI CD pipeline

Copper Contributor

We have been deploying our application through the CI CD pipeline for a few months. Recently we moved our azure subscription and since then the buld is failing with the below mentioned error.

The template deployment 'arm-templatestorage' is not valid according to the validation procedure. The tracking id is '2495f64a-3f30-4ff9-9864-013053900d5f'. See inner errors for details.
Details:
PreflightValidationCheckFailed: Preflight validation failed. Please refer to the details for the specific errors. [{"code":"StorageAccountAlreadyTaken","target":"monitzionarmstorage","message":"The storage account named monitzionarmstorage is already taken."}]
At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.
Details:
StorageAccountAlreadyTaken: The storage account named monitzionarmstorage is already taken.

 

 

We have not been able to figure out any issue in Azure settings to be causing this issue. Any insights into this would be helpful.

1 Reply

Has the storage account from the old subscription been removed?

 

That error refers to the fact that that storage account name is already taken (in use), Storage accounts are global resources (because they are usually published and accessed remotely via a URL), the name of the storage account may have been taken up by someone else using Azure.

With Infrastructure as code, I use a prefix (ie company name or something like 'diag' then a unique string based on the resource ID of the resource group, that it is deployed too, that way its global;ly unique and if I redeploy to the same resource group in the future (it knows its the same resource), if I deploy to another resource group (the name is different):

https://docs.microsoft.com/en-us/azure/azure-resource-manager/troubleshooting/error-storage-account-...
https://docs.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/resource-...