What is Resource Group in Azure

What is Resource Group in Azure

In this Azure tutorial, we will discuss What is resource group in azure. Along with this, we will also discuss the below topics.

  • What is the resource and what is Resource Group in Azure?
  • What is the subscription and resource group in Azure?
  • What is the purpose of a resource group?
  • Do Azure resource groups cost money?
  • Why do we need a resource group in Azure?
  • How do I organize my Azure Resource Group?
  • How to create a subscription?
  • Create a management group
  • Create Resource Group azure
  • How do I create a resource group in Powershell?
  • How many Resource Groups can a resource be added?
  • What is Azure resource manager
  • Azure Resource Groups best practices
  • How do I change the Azure Resource Group?
  • How do I add a user to a Resource Group in Azure?
  • How do I delete a resource group?
  • How do I delete a resource group in Azure PowerShell?
  • How do I restore a resource group in Azure?
  • How do I delete all resource groups in Azure?
  • How do I create a resource group in Azure CLI?
  • How do I find a Resource Group in Azure?

What is resource group in Azure

Well, let’s discuss here What is resource group in Azure.

Resource Group in Azure is nothing but a logical container where you are creating your Azure resources. That holds all your Azure Resources. A resource group created in a specific region can contain the resources created in the other regions. There is no restriction on that.

What is resource group in Azure

Resource groups are also called the central unit that acts like a logical container that holds all the Azure resources.

You need a Resource Group to be created while creating any of the resources in Azure Portal. This is few of my understanding on What is Resource Group in Azure

What is the resource and Resource Group in Azure?

Resource Group in Azure is the way to group a number of resources that help in multiple ways like automatic monitoring, access control, etc. Another benefit of Azure is to group all the resources that belong to an application together that helps for the management of the resources easily.

A resource is the instances of service that you create or an asset like Azure Virtual Machines, Azure storage, etc that are created in the Azure for multiple purposes.

What is subscription and resource group in Azure?

A Subscription is used to manage the costs and the number of resources that are created based on the plan for a user account or for an Organisation.

A subscription can define the limits of the number of resources that can be used under that plan for the particular account. A subscription can logically associate user accounts or organization accounts and the resources.

You can consider the Azure Subscription as the logical container for the Resource Groups and Resource Groups are the logical container for the Azure Resources. You can refer to the above image for a better understanding.

What is the purpose of a resource group?

Resource Groups in Azure is the approach to group the collection of resources that helps for easy maintenance of the Resources for example easy monitoring, automatic provisioning, etc. This is the main Purpose of the ResourceGroups.

Behind the scene, Azure Resource Manager (ARM) is technology that helps Azure for the activities.

Do Azure resource groups cost money?

The answer to this question is absolute No, There is no price for the Resource Group. You need to pay for the resources as per the pricing model. So you need to pay for the resources, not for the Resource Groups.

Why do we need resource group in Azure?

A Resource Group is a logical container that stores the metadata of the resources that helps for the administration activities and the cost management of the group of resources and also helps for the easy management of the role-based access.

How do I organize my Azure Resource Group?

There are 4 levels of management scope that Azure provides to manage the Azure Resources

  • Management Groups
  • Subscriptions
  • Resource Groups
  • Resources
How do I organize my Azure Resource Group

Management Groups

Management Groups are containers for multiple subscriptions that help to manage access and compliance. All subscriptions under the management groups inherit all the properties from the Management Groups.

Subscriptions

A Subscription is used to manage the costs and the number of resources that are created based on the plan for a user account or for an Organisation. Each subscription has limits on the number of resources you can create and use based on the plan. 

Resource Groups

Resource Group is a logical container where you are creating your Azure resources. That holds all your Azure Resources.

Resources

A resource is the instances of service that you create like Azure Virtual Machines, Azure Storage, Azure SQL, etc that are created in the Azure for multiple purposes.

Create a management group

You can create a management group by following the below steps

Login to Azure Portal (https://portal.azure.com/)

Now After Login to the Azure Portal, search for the “management groups” and click on the search result.

How to create a management group in Azure Portal

Click on the Start using managements groups button then you can fill the below options on the Add management group window.

Select the Create new option

Fill the Management group ID (Cannot be updated after creation) with a valid ID

Fill the Management group display name as a valid name and then click on the Save button to create the Management group.

Create a management group using Azure Portal

How to create a subscription

To create a subscription, you need to follow the below steps

Login to Azure Portal (https://portal.azure.com/)

Now After Login to the Azure Portal, search for the “Subscriptions and click on the search result.

How to create a Subscription in Azure

Then click on the Add button on the Subscriptions page to create the subscription.

How to create a Subscription in Azure portal

Create Resource Group azure

Let’s discuss here, how to create a resource group in Azure Portal. Follow the below steps to create a resource group in Azure Portal.

Login to Azure Portal (https://portal.azure.com/)

Now After Login to the Azure Portal, search for the “Resource Groups” and click on the search result.

Create Resource Group azure

Then on the Resource groups page, click on the +Add button

How to create Resource Group azure

On the Create a resource group page, provide the below details

  • Subscription: Choose your subscription
  • Resource group: Enter a valid name for the Resource group
  • Region: Choose a region for the Resource group
How to create a Resource Group azure

Click on the Review + Create button.

It will show that Validation passed. Then click on the Create button on the Create a resource group page.

How to create a Resource Group in azure

Now you can see the Resource group created successfully.

How to create a Resource Group in azure portal

This is how we can create a Resource group using the Azure Portal.

How do I create a resource group in Powershell?

We saw above, how we can create a resource group using the Azure Portal? Now we will discuss here, How do I create a resource group in Powershell?, Follow the below steps to create a resource group using PowerShell.

Before creating the resource group in PowerShell, you need to make sure that you need to install Azure PowerShell (Microsoft Azure PowerShell) on your machine. 

Assuming that you have Microsoft Azure PowerShell module installed on your computer, next is to follow the below steps.

Open the PowerShell ISE or Windows PowerShell module as Run as Administrator mode

How do I create a resource group in Powershell

If you have installed the Azure PowerShell module. Check the version of the module and consider installing the latest version. Use the below PowerShell cmdlet to check the version.

PS C:\WINDOWS\system32> Get-Module -ListAvailable -Name AzureRm.Resources | Select Version
create a resource group in Powershell

Login to Azure account

Before working with the Azure resource group, use the Login-AzureRmAccount cmdlet to login to your Azure Account.

PS C:\WINDOWS\system32> Login-AzureRmAccount
Create a resource group using Powershell

Provide your Azure credentials to login and then move to the next step.

Get subscription details

You can check the Subscription details using the below PowerShell cmdlet, in case you have multiple subscriptions.

PS C:\WINDOWS\system32> Get-AzureRmSubscription
How to change Azure Resource Group using PowerShell

In case of multiple Subscription, use the below cmdlet to switch for a particular Subscription

PS C:\WINDOWS\system32> Set-AzureRmContext –SubscriptionId {SubscriptionId}

Or you can also use the below PowerShell cmdlet

PS C:\WINDOWS\system32> Set-AzureRmContext -SubscriptionName "{SubscriptionName}"

Create a Resource Group

Finally, use the New-AzureRmResourceGroup cmdlet to create a resource group

PS C:\WINDOWS\system32> New-AzureRmResourceGroup -Name mynewresgrp -Location "Central US"

The name parameter specifies a name for the resource group and the location parameter to specify the location of the resource group.

This is how you can create a resource group using PowerShell.

How many Resource Groups can a resource be added?

Each resource can only exist in one resource group. If one resource needs to exist on a different deployment cycle it should be in another resource group.

How do I find a Resource Group in Azure?

There are multiple ways to find all the Resource Groups in Azure Portal

Once you will login to the Azure Portal, You can click on the Rrsource groups link from the left navigation, it will show you the list of Resource groups present.

How do I find a Resource Group in Azure

Or, you can search for the Resource groups and click on the search result link to get the list of Azure resource groups

How to find the Resource Group in Azure

What is Azure resource manager

Azure Resource Manager is the service that works behind the scene with Azure Resource Groups. This provides a management layer that helps to create, update, delete, or to manage the resources in your Azure account.

The benefits of using Resource Manager

There are many benefits with Azure Resource Manager

  • You can manage, and monitor all the resources as a group easily with the help of Azure Resource Manager.
  • It helps you provide many templates that help you to manage your infrastructure.
  • Another important thing is it helps you to apply the tags to all resources that help to logically organize all your resources.
  • It helps to define the dependencies between all the Azure resources

Azure Resource Groups best practices

Below are few best practices for the Azure Resource Groups

  • It is recommended to create an Azure resource group per region where the resources will be located.
  • There is a built-in policy that will report when the resource location doesn’t match the resource group location. As per the policy, the resource location and the resource group location should be the same. For more information on this refer to Azure best practices.

How do I change Azure Resource Group?

Follow the below steps to change the Azure Resource Group.

Login to Azure Portal (https://portal.azure.com/)

Search for the resource that needs to be migrated to the different resource group.

How do I change Azure Resource Group

Click on the Move button and then select the Move to another resource group option on the Resource Page.

How can I change Azure Resource Group

Select the new Resource group where the resource needs to be moved and check the I understand that tools and scripts associated with moving resources will not work until I update them to use new resource IDs option.

Then click on the Ok button to move the resource to the new Azure Resource Group.

How to change Azure Resource Group

This is how we can change a resource from one resource group to another.

How do I add a user to a Resource Group in Azure?

Well, here we will discuss how to add a User to your Azure Subscription with Resource Group Access. Follow the below steps

Login to Azure Portal (https://portal.azure.com/)

Now After Login to the Azure Portal, search for the “azure active directory” and click on the search result.

How do I add a user to a Resource Group in Azure

Click on the Users button from the left side menu

How can I add a user to a Resource Group in Azure

Click on the + New user button to create a new user

How to add a user to a Resource Group in Azure

Now follow the Article How to create a user in azure active directory and create the user. You can see i have created the new user

How to create a user in azure active directory

When this new user Test logs in for the first time, he won’t be able to see anything in the subscription until so we should grant him access to a specific resource group. 

Navigate to the Resource group, that you want to give access.

azure add user to resource group

Now click on the Access control (IAM), then click on the + Add button and click on the Add role assignment option.

azure add user to resource group 1

Select the role, Assign access to option and select the member to add as below, then finally click on the Save button.

add user to resource group

Now you are done, the user Test is now the owner of the resource group MyNewresgroupupdt. He can able to fully manage all the resources inside that group.

He can also create new resources inside the resource group.

This is how you can add a user to a Resource Group in Azure.

How do I delete a resource group?

If you have decided to delete the resource group, then follow the below steps to deletes the Resource group or stop a resource group in Azure.

Login to Azure Portal (https://portal.azure.com/)

Navigate to the resource group, you wan to delete and then click on the Delete resource group button.

How do I delete a resource group

Now type the Resource group name for the confirmation and then finally click on the Delete button to Delete the Resource Group.

How do you stop a resource group in Azure

This how we can delete the resource group or how do I delete a resource group in Azure using Azure Portal. Now, let’s discuss How do I delete a resource group in Azure PowerShell?

How do I delete a resource group in Azure PowerShell?

Well, let’s see here How to delete a resource group in Azure PowerShell?. Use the below PowerShell cmdlet to delete the resource group.

PS C:\WINDOWS\system32> Remove-AzResourceGroup -Name ResourceGroupName

For Example

PS C:\WINDOWS\system32> Remove-AzResourceGroup -Name MyNewresgroupupdt

Run the above command and then click on the Yes button for the confirmation on the delete operation

How do I delete a resource group in Azure using PowerShell

Once you click on the Yes button, the Resource Group will delete successfully with out any issue.

How do I restore a resource group in Azure?

Remember that, there is no direct way to restore a deleted resource group. Deleting a resource group is an irreversible action. Two workarounds you can try, in order to get back

  • You can try raising a ticket to Microsoft to restore it back.
  • We can also try to find the deployment template for the resources that we created earlier in our deleted resource group and then we can use the same template while creating a new one.

How do I create a resource group in Azure CLI?

Well, let’s see how to create a resource group in Azure using Azure CLI. You can use the below Azure CLI scripts to create a resource group

$resourceGroupName = "MyNewresgroup"
$location = "East US"

az group create --name $resourceGroupName --location $location

Once it is created you can use the below command to list all the resource groups

az group list

How do I delete all resource groups in Azure?

In order to delete all the resource groups using PowerShell, you can use the below PowerShell cmdlet

PS C:\WINDOWS\system32> Get-AzureRmResourceGroup | Remove-AzureRmResourceGroup

The above command uses the Get-AzureRmResourceGroup cmdlet to get all resource groups and then passes them to Remove-AzureRmResourceGroup by using the pipeline operator.

 Get-AzureRmResourceGroup cmdlet used to get all the resource groups and then it passes them to Remove-AzureRmResourceGroup with the help of pipeline operator.

How do I delete all resource groups in Azure

This is how we can delete all resource groups in Azure using PowerShell.

You may also like going through the below tutorials

Conclusion

Well in this article, We learned What is resource group in Azure, What is the resource and Resource Group in Azure? What is the subscription and resource group in Azure?, What is the purpose of a resource group?
Do Azure resource groups cost money?, Why do we need a resource group in Azure?, How do I organize my Azure Resource Group?
And Apart from these we also discussed How to create a subscription?, Create a management group, Create Resource Group azure, How do I create a resource group in Powershell?, How many Resource Groups can a resource be added?, What is Azure resource manager, Azure Resource Groups best practices

And then finally we discussed How do I change the Azure Resource Group?, How do I add a user to a Resource Group in Azure?, How do I delete a resource group?, How do I delete a resource group in Azure PowerShell?, How do I restore a resource group in Azure?, How do I delete all resource groups in Azure?, How do I create a resource group in Azure CLI?, How do I find a Resource Group in Azure? and How do you stop a resource group in Azure?. Hope you will enjoy this Azure tutorial !!!.

Leave a Comment