[英]Creating Azure Storage account from PowerShell giving error
I have Azure subscription where I am the owner of it.我有 Azure 订阅,我是它的所有者。 So, I have access to manage all resources.
因此,我有权管理所有资源。
I successfully login to Azure Account from PowerShell using command Connect-AzAccount
我使用命令
Connect-AzAccount
从 PowerShell 成功登录到 Azure 帐户
Now, I am trying to create a storage account using script like below:现在,我正在尝试使用如下脚本创建一个存储帐户:
New-AzStorageAccount -ResourceGroupName $resourceGroupName -Name $my_storage_Acc -Location $location -SkuName Standard_LRS
New-AzStorageAccount -ResourceGroupName $resourceGroupName -Name $my_storage_Acc -Location $location -SkuName 标准_LRS
But after executing the above command, I am getting the error like this:但是在执行上面的命令之后,我得到了这样的错误:
The client with my_object_id does not have authorization to perform action over scope(code:Authorization Failed)
具有 my_object_id 的客户端无权在范围内执行操作(代码:授权失败)
Can anyone help me why I'm getting this error though I've owner role for subscription and how to get rid of that error?任何人都可以帮助我为什么我有订阅的所有者角色时会收到此错误以及如何消除该错误?
As per the error, it said that you don't have enough permission to do this action.根据错误,它表示您没有足够的权限执行此操作。 It's an authorization issue.
这是一个授权问题。 But you said that you are the owner of this subscription.
但是你说你是这个订阅的所有者。 I have a question, what have you declared in the my_object_id ?
我有一个问题,你在my_object_id中声明了什么?
To create Azure Storage Account you can use this script.要创建 Azure 存储帐户,您可以使用此脚本。
# Variables
$ResourceGroup="MyResourceGroup007"
$StorageName="webappstorage007"
$Location="West US"
# Create a Resource Group
New-AzResourceGroup -Name $ResourceGroup -Location $Location
# Create Storage Account
New-AzStorageAccount -Name $StorageName -ResourceGroupName $ResourceGroup -Location $Location -SkuName Standard_LRS
This script can create a storage account successfully.此脚本可以成功创建存储帐户。 Check the following Screenshot.
检查以下屏幕截图。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.