问题描述
在实施新模型之后,我的所有网站现在都属于称为"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 DB和网站组合到一个资源组中?
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 Apps(以前称为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资源组的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!