How To Create A Resource Group In Azure Portal

Azure Management Groups Vs Resource Groups

Resource groups are an important organizational structure within Azure. As you create resources in Azure, you must specify one Resource Group that the resource needs to belong to. This is how you organize resources within a subscription. At the highest level of the Azure hierarchy, we have Management Groups. The next level down is Subscriptions, and then after that are the Resource Groups. Note that Resource Groups can not be nested, they are a single-level entity. Resource Groups are very convenient because you are allowed to set policies that will have an effect on all resources contained in the resource group. You can also look at a detailed deployment history of resources in the resource group. Lastly, you can also delete the entire resource group in one shot if you need to get rid of several resources all at once. You will be using Resource Groups all the time in Azure so it makes sense to review How To Create A Resource Group In Azure Portal.

To get started creating a resource group in Azure Portal select Resource groups.

In Azure Select Resource Groups


From the Resource groups blade, click Create.

 

azure - home - resource groups - create


Basics Tab:

Note: Resource group names only allow alphanumeric characters, periods, underscores, hyphens, and parenthesis and cannot end in a period.

Resource group – A container that holds related resources for an Azure solution. The resource group can include all the resources for the solution, or only those resources that you want to manage as a group. You decide how you want to allocate resources to resource groups based on what makes the most sense for your organization.

At the Create a resource group step There are three mandatory fields.  Those are Subscription, Resource group, and Region.  The subscription will auto-select if you have only one subscription.  If there are multiple subscriptions, make sure to select the correct subscription where you want the resource group to be created.  For the Resource group option, provide a name that meets the requirements from the Note above.  The last option is to select the Region where the resource group will be deployed.  In this example, it is (US) East US.

azure create resource group basics


Tags Tab:

Apply tags to your Azure resources to logically organize them by categories. A tag consists of a key (name) and a value. Tag names are case-insensitive and tag values are case-sensitive.

Note: Tag names are case-insensitive and are limited to 512 characters.

Note: Tag values are case-sensitive and are limited to 256 characters.

Tags are not mandatory, however, they are a best practice for being able to organize and track resources appropriately, so we will add an example tag name-value pair here.

 

azure create a resource group tags


Review + create Tab:

Once you select Review + create you should see that the validation has passed.  In addition, you will see the subscription this resource group will belong to, the name of the resource group, its region, and any associated tags.

azure create a resource group validation passed

 


At this step, you can now click Create to deploy the resource group, or you can select Download a template for automation.  We will review the template download in a minute but for now lets click Create.

azure click create to create resource group

 


The message should appear in the Azure Portal that a Resource group was created.  Our message states that “Creating resource group ExampleResourceGroup in subscription Azure subscription succeeded”.

azure resource group created success message

 


We click on Go to resource group and land at the Overview option on the Resource Group Blade.  The resource group has all of the parameters that we assigned to it during creation and everything looks great.

Go to the deployed resource group

 


Download a template for automation

Let’s review what happens when you click Download a template for automation. You will be taken to Home > Resource groups > Create a resource group > Template. From here you can view the Template, Parameters, and Scripts. We’ll choose Download for the moment.

 

azure download template for create resource group

 


When you download the template, it will come down as a template.zip file. Extract the contents of that file on your machine and you will see two files:

  • template.json
  • parameters.json

downloaded azure json template with parameters


The contents of these files are as follows:

template.json

{
    "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
    "contentVersion": "1.0.0.1",
    "parameters": {
        "rgName": {
            "type": "string"
        },
        "rgLocation": {
            "type": "string"
        },
        "tags": {
            "type": "object",
            "defaultValue": {}
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.Resources/resourceGroups",
            "apiVersion": "2018-05-01",
            "location": "[parameters('rgLocation')]",
            "name": "[parameters('rgName')]",
            "properties": {},
            "tags": "[parameters('tags')]"
        }
    ],
    "outputs": {}
}

parameters.json

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "rgName": {
            "value": "ExampleResourceGroup"
        },
        "rgLocation": {
            "value": "eastus"
        },
        "tags": {
            "value": {
                "Example Tag Name": "Example Tag Value"
            }
        }
    }
}

Add to library

Azure now offers the option to save the template right into Azure for use at a later time. In this approach, you wouldn’t even need to download the template.zip file to a local machine. Let’s try this option out.  Instead of clicking Download as we did just above, we now click Add to library.

 

azure template add to library

 


At the Save template stage, we need to fill in a Name and a Description.  Our template name will be “Example_Resource_Group_Template”.  Our template description will be “This is a nice way to save templates right in the Azure cloud with no need to download to local machine”. Once you select Save, the template will be saved to More services > Templates.

 

azure save template name description

 


Now to make use of the template at a later time we can simply click More services.

 

azure click more services

 


In the All services menu type templates, then select the Templates option you see on the screen.

all services templates

 


Now we see the Templates page that has the example resource group template we had created earlier.

 

the example template is stored in templates

 


After clicking on the template link, we can see the description we gave earlier of “This is a nice way to save templates right in the Azure cloud with no need to download to local machine”. In addition, we can choose to Deploy, Edit, Delete, or Share.

azure viewing stored template

 


Lastly, you can also view the template right in the browser.

view example resource group template


How To Create A Resource Group In Azure Portal

Resource Groups in Azure will make your life much easier. They will help you with applying policies as needed, organize your resources, and track your costs more easily. In addition, you can put locks on resource groups so that resources are protected from deletion. Organizing your resources is much easier as well. Lastly, it’s good to note that a resource group belongs to a location but the resources inside do not have to be in the same location. With that, you are well on your way to becoming a Resource Group Master in Azure.