Azure PowerShell - 无法识别资源组

标签 azure powershell azure-powershell

问题:为什么我在下面所示的 powershell 脚本的最后一行中收到以下错误 - 我们如何修复该错误?我通过从 Azure 门户复制/粘贴资源组 (RG) 名称进行了双重检查,以验证 RG 名称是否正确:

Get-AzStorageAccount: Resource group 'rg-e-testdataanalytics-dev-01' could not be found

# these are for the storage account to be used
$resourceGroup = "rg-e-testdataanalytics-dev-01"
$storageAccountName = "myStorageAccount"

# get a reference to the storage account
$storageAccount = Get-AzStorageAccount -ResourceGroupName $resourceGroup -Name $storageAccountName

最佳答案

您很可能处于错误的 Azure 上下文中。要验证这一点,请运行命令 Get-AzContext,该命令将返回 Active Directory account, Active Directory tenant, Azure subscription, and the targeted Azure environment .

Azure 资源管理器 cmdlet 在发出 Azure 资源管理器请求时默认使用这些设置。因此,请确保您处于正确的 Active Directory 帐户/Active Directory 租户/Azure 订阅/Azure 环境中。

如果您订阅错误,可以设置subscription context通过

Set-AzContext -Subscription "xxxx-xxxx-xxxx-xxxx"

关于Azure PowerShell - 无法识别资源组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76447431/

相关文章:

azure - 无法通过 Databricks 笔记本从 Azure 存储容器中删除目录

powershell - 在Power BI中开发自定义视觉效果

Powershell,foreach 的分页输出

linux - 单个 VNet/子网中 Azure VM 的保留 IP

azure - 获取子网中可用 IP 地址的列表

powershell - 如何获取在 Azure Function 中运行的 Azure PowerShell 模块版本列表?

asp.net-mvc - ASP.NET 用户未发布到 Azure

powershell - 将 .vhd 镜像从 Azure 下载到本地计算机,然后上传到另一个 Azure 帐户

python - 有人试图侵入我的 Django 应用程序吗?

c# - ASP.NET 托管 Active Directory RSAT powershell 脚本--DC 挂断