如何更改 Azure 资源组的名称? [英] How do I change the name of an Azure Resource Group?

查看:27
本文介绍了如何更改 Azure 资源组的名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实施新模型后,我的所有网站现在都属于名为Default-Web-East"的单个资源组,而我的所有 SQL 数据库都属于名为Default-SQL-East"的单个资源组.

After the new model was implemented, all of my websites now belong to individual Resource Groups called "Default-Web-East" and all of my SQL databases belong to individual Resource Groups called "Default-SQL-East".

这至少可以说令人困惑.

This is confusing to say the least.

我想重命名这些组以具有某种语义含义.我还想将关联的 SQL 数据库和网站分组在同一个资源组中.

I would like to rename the groups to have some semantic meaning. I would also like to group the associated SQL database and Web Site in the same Resource Group.

但是,我也看不出有什么可做的.这可能吗?

However, I do not see anyway to do either. Is this possible?

1) 重命名资源组?2) 将现有的 SQL 数据库和网站合并到一个资源组中?

1) Rename the Resource Group? 2) Combine an existing SQL DB and Website together into one Resource Group?

推荐答案

您不能重命名 Azure 资源组.

You can't rename an Azure Resource Group.

您可以将资源移至新的资源组.将资源组 A 中的所有资源移至资源组 B 是穷人的重命名.

What you can do is move your resources to a new Resource Group instead. Moving all resources in Resource Group A to Resource Group B is the poor man's rename.

遗憾的是,并非所有资源提供者都允许您在资源组之间移动资源,有些提供者可能附加了仅允许您在特定条件下移动资源的条件.

Unfortunately not all resource providers let you move resources between resource groups, and some that do might have strings attached that only let you move resources under certain conditions.

对于 Azure Web 应用程序(以前称为 Azure 网站),您目前只能在一次调用中移动所有与网站相关的资源.所有网站相关资源"是指提供者Microsoft.Web"下的所有资源.这包括源资源组中的所有网站、应用托管平台和证书.

For Azure Web Apps (previously called Azure Websites) you can currently only move all the websites related resources in a single invocation. That "all websites related resources" means all resource under the provider "Microsoft.Web". This includes all websites, app hosting platforms, and certificates that are in the source resource group.

通过门户网站

查看群组资源时,您可以使用移动"标签

When viewing a group's resources, you can use the "Move" tab

单击移动"选项卡将显示以下内容,允许您选择或创建新组:

Clicking the "Move" tab will show something this, allowing you to choose or create a new group:

通过 Azure Powershell

最简单的方法是使用 Move-AzureRmResource powershell cmdlet.

The easiest way to do this is to use the Move-AzureRmResource powershell cmdlet.

命令如下所示:

Get-AzureRmResource -ResourceGroupName <sourceResourceGroupName> | Move-AzureRmResource -DestinationResourceGroupName <destResourceGroupName>

来源:https://azure.microsoft.com/en-us/documentation/articles/resource-group-move-resources/


通过 Rest API

另一种方法是使用 MoveResource Rest API 或使用 ArmClient.

The other way to do this is to use the MoveResource Rest API or with the ArmClient.

这是您要进行的 API 调用:

Here's the API call you'll want to make:

POST https://<endpoint>/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/moveResources?api-version={api-version}

其中 {resourceGroupName} 是源资源组.

我很确定端点应该是https://management.azure.com",但是如果您使用 ArmClient 该工具会很小心为您提供端点.

I'm pretty sure the endpoint should be "https://management.azure.com", but if you use the ArmClient the tool will just take care of the endpoint for you.

请求正文:

{
   "targetResourceGroup": "/subscriptions/{subscriptionId}/resourceGroups/{targetResourceGroupNameName}",
   "resources":
   [  
     "/subscriptions/{id}/resourceGroups/{source}/providers/{namespace}/{type}/{name}",
     "/subscriptions/{id}/resourceGroups/{source}/providers/{namespace}/{type}/{name}"
   ]
}

这篇关于如何更改 Azure 资源组的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆