简体   繁体   English

从 PowerShell 创建 Azure 存储帐户时出现错误

[英]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.

相关问题 PowerShell REST 从 Azure 存储帐户表中删除 - PowerShell REST DELETE from Azure Storage Account Table Output Azure Function powershell值到azure存储账户 - Output Azure Function powershell value to azure storage account Zip 从存储帐户部署 azure function - Zip deploy azure function from storage account 从 Azure Devops Hosted Agents 访问私有存储帐户 - Accessing a private storage account from Azure Devops Hosted Agents 更改 Azure 存储帐户 TLS 版本 - Change Azure Storage Account TLS versions 如何从公共 azure 私人存储帐户连接到 azure static web 应用程序 - How to connect to a azure private storage account from a public azure static web app 如何使用 Azure CLI 从特定的 Azure 存储帐户获取所有容器? - How to Get All the Containers From a Specific Azure Storage Account using Azure CLI? Terraform 使用专用端点创建 function 应用程序和存储帐户时出现 403 错误 - Terraform 403 error when creating function app and storage account with private endpoint Azure 使用客户管理的密钥进行存储帐户加密 - Azure storage account encryption with customer managed keys 从 PowerShell 创建 Azure VM 时是否可以安装应用程序? - Is it possible to install application while creating Azure VM from PowerShell?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM