What is resource group in Azure

What is resource group in Azure

·

13 min read

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

A 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 t

What is resource group in Azure

Azure resource group

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 which 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

what is a 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

A 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 (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

resource group Azure

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

Azure powershell resource group

How to create a subscription

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

Login to Azure Portal (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

resources group Azure

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

How to create a Subscription in Azure portal

What is meant by resource group in Azure?

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 (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

What is resource group in Azure?

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

How to create Resource Group azure

Create resource group Azure powershell

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

what is Azure resource group

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

resource group in Azure

Now you can see the Resource group created successfully.

How to create a Resource Group in azure portal

what is resource group in Azure portal

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

Create resource group Azure 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

how to create resource group in azure 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

what is a resource group in azure

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

create resource group azure

Provide your Azure credentials to log in 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

what are azure resource groups

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 specifies 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 log in to the Azure Portal, You can click on the Resource 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

get azure resource group

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 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 manage the resources in your Azure account.

The benefits of using Resource Manager

There are many benefits to 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 a 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 (portal.azure.com)

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

How do I change Azure Resource Group

Azure subscription 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

Azure resources group

Select the new Resource group where the resource needs to be moved and check that 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

Azure PowerShell create 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 (portal.azure.com)

Now, After log in 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

create azure resource group Powershell

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

azure create resource group

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

create azure resource group

Now you are done, the user Test is now the owner of the resource group MyNewresgroupupdt. He can able 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 delete the Resource group or stop a resource group in Azure.

Login to Azure Portal (portal.azure.com)

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

azure delete 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 is 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

remove resource group azure powershell

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

Related: How do I restore a resource group in Azure?

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 is used to get all the resource groups and then it passes them to Remove-AzureRmResourceGroup with the help of the pipeline operator.

How do I delete all resource groups in Azure

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

What is resource in Azure

  • A resource is an item that is manageable and available via Azure.

  • You can also call the resource the key component of Azure.

List of Azure resources

Well, Azure provides us with many resources. Below is the list of a few important resources that you should keep in mind while working with Azure.

  • Virtual Machines (VM)

  • Virtual Networks

  • Storage Accounts

  • Web apps

  • Databases

  • Resource Groups

  • Management Groups

  • Subscriptions

Azure resource group vs subscription

Azure resource group

  • Azure resource group acts as a logical container where you can deploy and manage your Azure resources.

  • You have the provision to choose under which resource group, you want to keep which resources.

Subscription

  • Subscription is something that is associated with the user accounts and the resources they use or consume.

  • You can use the subscriptions to manage the resources created by you or the overall costs.

  • Your subscription will have certain limits on the resources you can use.