New-AzureResourceGroup failed to update

Hi,

I try to update an existing resource group with the New-AzureResourceGroup powershell command from the Azure Resource Group cmdlet.

I'm using Visual Studio 2016, Azure SDK 2.7 and the 'Resource Group' project template.

When I deploy to an existing resource group, i'm receiving the following error for resources that already exist:

"[ERROR] New-AzureResourceGroup : 18:02:31 - Resource Microsoft.Storage/storageAccounts

18:02:31 - [ERROR] 'someResource' failed with message 'The storage account named

18:02:31 - [ERROR] someResource is already taken.'"

If I understand correct from this documents

"https://azure.microsoft.com/en-gb/documentation/articles/resource-group-overview/" and

"https://azure.microsoft.com/en-gb/documentation/articles/resource-group-template-deploy/"

New-AzureResourceGroup will add the new resources and update existing.

The question is, how can I avoid the error message?

This is a snipped from the ps script that is generated by the VS project and executed:

New-AzureResourceGroup -Name $ResourceGroupName `
                       -Location $ResourceGroupLocation `
                       -TemplateFile $TemplateFile `
                       -TemplateParameterFile $TemplateParametersFile `
                        @OptionalParameters `
                        -Force -Verbose

Thanks

July 23rd, 2015 12:23pm

Hi,

You are right saying that New-AzureResourceGroup can update an existing resource, but only if the resource has been created from the exact same deployment.

By default if you don't specify the name of the deployment it will take the name of the template. Having that said, for your insert/update scenario to work, the resource must not exist before your first deployment, otherwise it will complain that the name is already in use, which is the case actually.

Have a good one

  • Proposed as answer by s_lapointe 14 hours 36 minutes ago
Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 12:45pm

Hi,

You are right saying that New-AzureResourceGroup can update an existing resource, but only if the resource has been created from the exact same deployment.

By default if you don't specify the name of the deployment it will take the name of the template. Having that said, for your insert/update scenario to work, the resource must not exist before your first deployment, otherwise it will complain that the name is already in use, which is the case actually.

Have a good one

  • Proposed as answer by s_lapointe Thursday, July 23, 2015 4:43 PM
July 23rd, 2015 4:42pm

Hi,

You are right saying that New-AzureResourceGroup can update an existing resource, but only if the resource has been created from the exact same deployment.

By default if you don't specify the name of the deployment it will take the name of the template. Having that said, for your insert/update scenario to work, the resource must not exist before your first deployment, otherwise it will complain that the name is already in use, which is the case actually.

Have a good one

  • Proposed as answer by s_lapointe Thursday, July 23, 2015 4:43 PM
Free Windows Admin Tool Kit Click here and download it now
July 23rd, 2015 4:42pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics