Unable to deploy Storage Account using VS Code.

Nilesh Jha 0 Reputation points
2024-05-03T05:28:30.8233333+00:00

I have created a json file to create storage account

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {},
    "functions": [],
    "variables": {},
    "resources": [
        {
            "name": "storageaccount1",
            "type": "Microsoft.Storage/storageAccounts",
            "apiVersion": "2023-01-01",
            "tags": {
                "displayName": "storageaccount1"
            },
            "location": "[resourceGroup().location]",
            "kind": "StorageV2",
            "sku": {
                "name": "Premium_LRS",
                "tier": "Premium"
            }
        }
    ],
    "outputs": {}
}

I have also create a file named storage.ps1 and now while doing .\storage.ps1 which would be calling above script rs.json to create Storage account I am getting below error:

New-AzResourceGroup : Method 'get_SerializationSettings' in type 'Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient' from assembly

'Microsoft.Azure.PowerShell.Clients.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation.

At C:\Users\jhani\Documents\Azure\storage.ps1:2 char:1

  • New-AzResourceGroup -Name $rg -Location northeurope -Force
$rg = "new-rg"
New-AzResourceGroup -Name $rg -Location northeurope -Force

New-AzResourceGroupDeployment `
    -Name 'new-storage' `
    -ResourceGroupName $rg `
    -TemplateFile 'rs.json'
Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,795 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Nehruji R 3,196 Reputation points Microsoft Vendor
    2024-05-03T07:39:35.91+00:00

    Hello Nilesh Jha,

    Greetings! Welcome to Microsoft Q&A Platform.

    The error message you’re seeing typically indicates a conflict between the AzureRM and Az modules.

    1.This kind of error arises when there is a confliction between AzureRM and Az modules. Make sure that you have uninstalled AzureRM modules and try connecting with Az account again.

    Uninstall-AzureRm
    Get-Module -Listavailable Az.*
    

    Once it is done, update the Az modules or re-install the Az modules with the below command.

    Install-Module -Name Az -Force -AllowClobber
    

    2.We recommend you try using Az.Accounts version 2.12.2 and Vs code PowerShell extension versions. Lower the version to Az.Accounts 2.12.1 and re-run the script.

    3.Check if there are any proxy settings that might be blocking the connection to Azure services. If yes, change the configuration settings and execute it. If still the issue persists, restart your visual studio code and try executing the command again.

    refer similar SO thread - https://learn.microsoft.com/en-us/answers/questions/1299863/how-to-fix-method-get-serializationsettings-does-n

    Hope this helps! Please let us know if you have any further queries. I’m happy to assist you further.


    Please "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments