Azure Powershell核心功能存储帐户创建问题

码:

 Get-AzureRmSubscription
         Select-AzureRmSubscription  -SubscriptionId "000-0000-0000-0000-000"
         $resourceGroup = "TestPowerShellFunction"
         $location = "eastus"

         $storageAccountName = "testpshstorageacc"
         $skuName = "Standard_LRS"

         # Create  the storage account.
         $storageAccount = New-AzStorageAccount -ResourceGroupName $resourceGroup `
         -Name $storageAccountName `
         -Location $location `
         -SkuName $skuName


         $body = "test"

错误信息:

2020-02-28T12:27:28.819 [错误]错误:New-AzStorageAccount:“ this.Client.SubscriptionId”不能为空。 在D:\ home \ site \ wwwroot \ HttpTrigger1 \ run.ps1:38 char:28 + ... ageAccount = New-AzStorageAccount -ResourceGroupName $ resourceGroup` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ + CategoryInfo:CloseError :( :) [New-AzStorageAccount],ValidationException + FullyQualifiedErrorId:Microsoft.Azure.Commands.Management.Storage.NewAzureStorageAccountCommand

脚本堆栈跟踪:    在,D:\ home \ site \ wwwroot \ HttpTrigger1 \ run.ps1:第38行

Microsoft.Rest.ValidationException: 'this.Client.SubscriptionId' cannot be null. at Microsoft.Azure.Management.Storage.StorageAccountsOperations.CheckNameAvailabilityWithHttpMessagesAsync(String name, Dictionary2 customHeaders, CancellationToken cancellationToken) at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.CheckNameAvailabilityAsync(IStorageAccountsOperations operations, String name, CancellationToken cancellationToken) at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.CheckNameAvailability(IStorageAccountsOperations operations, String name) at Microsoft.Azure.Commands.Management.Storage.NewAzureStorageAccountCommand.ExecuteCmdlet() at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__31.b__3_0(T c) at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor) at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet) at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()

Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException:结果:错误:New-AzStorageAccount:“ this.Client.SubscriptionId”不能为空。 在D:\ home \ site \ wwwroot \ HttpTrigger1 \ run.ps1:38 char:28 + ... ageAccount = New-AzStorageAccount -ResourceGroupName $ resourceGroup` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ + CategoryInfo:CloseError :( :) [New-AzStorageAccount],ValidationException + FullyQualifiedErrorId:Microsoft.Azure.Commands.Management.Storage.NewAzureStorageAccountCommand

脚本堆栈跟踪:    在,D:\ home \ site \ wwwroot \ HttpTrigger1 \ run.ps1:第38行

Microsoft.Rest.ValidationException: 'this.Client.SubscriptionId' cannot be null. at Microsoft.Azure.Management.Storage.StorageAccountsOperations.CheckNameAvailabilityWithHttpMessagesAsync(String name, Dictionary2 customHeaders, CancellationToken cancellationToken) at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.CheckNameAvailabilityAsync(IStorageAccountsOperations operations, String name, CancellationToken cancellationToken) at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.CheckNameAvailability(IStorageAccountsOperations operations, String name) at Microsoft.Azure.Commands.Management.Storage.NewAzureStorageAccountCommand.ExecuteCmdlet() at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__31.b__3_0(T c) at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor) at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet) at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()

Exception: 'this.Client.SubscriptionId' cannot be null. Stack: at Microsoft.Azure.Management.Storage.StorageAccountsOperations.CheckNameAvailabilityWithHttpMessagesAsync(String name, Dictionary2 customHeaders, CancellationToken cancellationToken) at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.CheckNameAvailabilityAsync(IStorageAccountsOperations operations, String name, CancellationToken cancellationToken) at Microsoft.Azure.Management.Storage.StorageAccountsOperationsExtensions.CheckNameAvailability(IStorageAccountsOperations operations, String name) at Microsoft.Azure.Commands.Management.Storage.NewAzureStorageAccountCommand.ExecuteCmdlet() at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__31.b__3_0(T c) at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor) at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet) at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()