One thought on “PowerShell function to create Azure storage account

  1. New-AzureStorageAccount -ResourceGroupName “GOWRISH-RG” -Location westeurope -SkuName Standard_LRS

    ResourceGroupName : GOWRISH-RG
    Location : centralus
    ProvisioningState : Succeeded
    Tags :
    ResourceId : /subscriptions/784f3106-4c8c-476d-b802-e4826391d5637/resourceGroups/GOWRISH-RG

    You cannot call a method on a null-valued expression.
    At line:45 char:9
    + $StorageAccName = ($Prefix + $SARandomName + $Suffix).ToLower …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    Get-AzureRmStorageAccountNameAvailability : Cannot validate argument on parameter ‘Name’. The argument is null or empty.
    Provide an argument that is not null or empty, and then try the command again.
    At line:46 char:73
    + … vailability = Get-AzureRmStorageAccountNameAvailability -Name $SAName
    + ~~~~~~~
    + CategoryInfo : InvalidData: (:) [Get-AzureRmStor…ameAvailability], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Azure.Commands.Management.Storage.StorageAccount.Get
    AzureStorageAccountNameAvailability

    New-AzureStorageAccount : Unexpected error occured during storage account creation. Error: Cannot validate argument on
    parameter ‘Name’. The argument is null or empty. Provide an argument that is not null or empty, and then try the command
    again.
    At line:62 char:1
    + New-AzureStorageAccount -ResourceGroupName “GOWRISH-RG” -Location wes …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-AzureStorageAccount

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.