Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
3 views
in Azure by (16.8k points)

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.

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) Rename the Resource Group? 2) Combine an existing SQL DB and Website together into one Resource Group?

3 Answers

+1 vote
by (45.3k points)

No, you cannot rename an Azure Resource Group, all you can do is move an existing resource group to a new resource group.

In the case of Azure Web Apps, you can only move all websites related resources in one invocation. This "all websites related resources" includes all websites, app hosting platforms, and certificates.

From the Portal

Use the "Move" tab for viewing resource groupsScreenshot of resource group options in portal

Clicking the "Move" tab will show this, which allow you to choose or create a new group: The move tab in resource group on Azure portal

Now Using Azure Powershell

use the Move-AzureRmResource powershell cmdlet.

The command for this:

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

Using the Rest API:

Another way to is you use the MoveResource Rest API or an ArmClient.

This is how you will make an  API call:

POST 

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

Where {resourceGroupName} is the source resource group. If you are using the ArmClient tool, then it will just take care of the endpoint. 

Request Body:

{

   "targetResourceGroup": "/subscriptions/{subscriptionId}/resourceGroups/{targetResourceGroupNameName}",

   "resources":

   [  

     "/subscriptions/{id}/resourceGroups/{source}/providers/{namespace}/{type}/{name}",

     "/subscriptions/{id}/resourceGroups/{source}/providers/{namespace}/{type}/{name}"

   ]

}

If you want to have a successful Azure career then you can visit the Microsoft Azure tutorial for Beginners and join AZ-104 certification

0 votes
by (47.2k points)

You cannot rename existing resources. If you're trying to standardize existing resources, it becomes impossible to adopt a universal naming convention. To an extent, this makes sense. In many cases, the object name becomes a DNS name and is referenced in the object's resource ID.

0 votes
by (9.6k points)

You cannot change the name of your resource group, but you can surely move your resources to a new one, in the following way (Azure Portal):

image

image

Related questions

Browse Categories

...