(ResourceGroupNotFound) 资源组“????”创建天蓝色媒体服务帐户时找不到

问题描述 投票:0回答:6

我正在尝试使用此处的说明创建服务主体帐户

https://learn.microsoft.com/en-us/azure/media-services/latest/stream-files-tutorial-with-api#examine-the-code-that-uploads-encodes-and-streams

但是当我运行命令时

az ams account sp create --account-name *media_service_account_name* --resource-group *resource_group_name*

其中 media_service_account_name 是我创建的媒体服务显示的名称,resource_group_name 是同一页面上显示的资源组的名称。

问题是我收到消息

ResourceGroupNotFound

找不到资源组“resource_group_name”。

我只是看不出我做错了什么。任何帮助表示赞赏。

azure-media-services
6个回答
137
投票

如果您有多个订阅,请先设置您的订阅,然后尝试:

  • 列出所有订阅 -
    az account list --output table
  • 设置您的订阅 -
    az account set --subscription <subscription-id>
  • 使用 Powershell 设置订阅 -
    Set-AzContext <subscription_id>

12
投票

请按照以下步骤解决上述错误:

  1. az login
    它会要求您提供凭据

  2. az account list --o table
    // 将列出所有订阅

设置要执行查询的订阅 3.

az account set --subscription
“VS订阅”

希望对你有帮助


12
投票

我遇到了同样的问题,并使用 az account show 验证了订阅,但我缺少的是我正在 powershell 中工作,需要在 powershell 中设置正确的订阅。 验证上下文:Get-Azcontext 设置上下文:Set-Azcontext


7
投票

您可能有多个订阅。将订阅设置为您要在 CLI 中使用的默认订阅。

参考:https://learn.microsoft.com/en-us/cli/azure/manage-azure-subscriptions-azure-cli?view=azure-cli-latest


6
投票

我在

task: AzureCLI@2
中运行
azure pipeline
来创建 azure vwan。 我输入了 az 帐户
set --subscription xxxxxxx-xxxx-xxx-xxxx-xxxxxxxxx
但它仍然不起作用并且正在抛出:

ERROR: (ResourceGroupNotFound) Resource group 'test-rg' could not be found.

然后我在他

--subscription "xxxxxxx-xxxx-xxx-xxxx-xxxxxxxxx"
的末尾添加了
az network vwan create
,尽管它没有在 文档中显示。

我是这样做的:

az network vwan create --name testwan01 --resource-group test-rg --subscription "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" --type Standard

如果您从 Jenkins 或 Azure 管道等编排工具运行它,希望它能有所帮助。


1
投票

请记住,Azure 中的资源组是您创建的,因此本文仅提供资源组名称的示例。

创建服务主体的命令要求您使用用于创建媒体服务帐户的资源组。

az ams account sp create --account-name amsaccount --resource-group **amsResourceGroup**

确保您使用的资源组名称与您首次创建媒体服务帐户时使用的资源组名称相同,并使用与您的帐户位于同一区域的唯一命名名称。我通常在创建新帐户之前调用 az group create,将其与我为其创建的存储帐户一起放入它自己的资源组中。

示例 在美国西部区域创建一个名为“MyResourceGroup”的新资源组。

az group create -l westus -n 

希望有帮助!

© www.soinside.com 2019 - 2024. All rights reserved.