How to get Azure Storage Account to classify

We recently built an infrastructure for deploying infrastructure and applications using Azure Resource Manager and templates. To deploy the cloud service, you must first configure your Azure Storage account. Recently, this has been achieved by running:

Switch-AzureMode AzureResourceManager New-AzureStorageAccount -ResourceGroupName $resourceGroupName -StorageAccountName $storageAccountName -Location $locationName -Type Standard_LRS 

This will create a storage account that the New-AzureDeployment cmdlet can use to deploy. As far as I remember, the created vault account would be the one that is now designated as "classic" in the user interface. However, with the latest changes, the storage account created using the script above is non-classic (V2). This V2 account is not recognized by New-AzureDeployment, and it throws it into a Powershell script:

New-AzureDeployment: ResourceNotFound: account "teststorage" not found.

If I manually create a classic vault account in the user interface, I can use it for my deployment and it works fine.

So, you can do one of the following:

  • Use a vault account that will be created as classic using Powershell?
  • Have the New-AzureDeployment cmdlet use a V2 storage account through Powershell?
+6
source share
3 answers

Return to asm mode (v1 api) and create a storage account:

 switch-azuremode -Name AzureServiceManagement 
+4
source

In fact, you can use ARM (Azure Resource Manager) to create a Classic storage account (that is, the old portal). To do this, add json to your "Resources" section, setting the parameters as you need. The benefit that this has in response to @Trondh is that it will be provided as part of your resource group. When you return to ASM, your classic account will simply be added to a random resource group that you cannot move.

  { "name": "[concat(parameters('BuildStorageName'), 'classic')]", "type": "Microsoft.ClassicStorage/storageAccounts", "location": "[parameters('BuildStorageLocation')]", "apiVersion": "2015-06-01", "dependsOn": [ ], "properties": { "accountType": "[parameters('BuildStorageType')]" } } 
+3
source

Because someone might find this useful in later versions of Azure Resource Manager (my version was 1.0.4) ....

In recent versions of AzureRM for PSVersion 5.0.10514.6, this can be done using the powershell cmdlet.

Assuming you have:

a) Identified to Azure RM: Login-AzureRMAccount

b) Already created a resource group: New-AzureRmResourceGroup -Name $ resourceGroupName -Location "South Central US"

Then you can do something like this to get a classic storage account:

New-AzureRmResource -ResourceName "-ResourceGroupName $ resourceGroupName -ResourceType" Microsoft.ClassicStorage / StorageAccounts -Location "South Central US" -Properties @ {AccountType = "Standard_LRS"} -ApiVersion "2015-06-01"

0
source

All Articles