A resource group is a container that contains different resources in your in your Azure account.
You can add any kind of resources you want to manage under one resource group.
You can create a resource group based of your orgs preferences. It would be meaningful to create a resource group based on region as well under which you can create resouces in specific region. For example: create a resource group where you want to create resources in eastus2 region. So we can create a resource group and name it a “thewebspark-eastus2-dev”.
The resource group stores metadata about the resources. Therefore, when you specify a location for the resource group, you are specifying where (region) metadata is stored.
Provisioning of Resource Groups through Azure Portal
Step 1: Go to Azure portal and search for resource groups

Step 2: Enter the resource group name and select the region

Step 3: Enter the tags if required

Step 4: Review and Create the resource group

This will now create a resource group for you in azure.

Now whenever you want to create any resources in eastus2 region you can provide this resource group name while provisioning.
Provisioning of Resource Groups through Azure CLI
Let us now create a resource group via Azure CLI
Step 1: Open CMD in your windows os and Login to Azure CLI
Use $ az login command

Step 2: Run the following command
$ az group create –name thewebspark-eastus2-dev –location eastus2

You will get provisioningState as “Succeeded”
Step 3: Go to Azure portal and check if the resource group deployment was successful

Provisioning of Resource Groups through Azure ARM Templates
Step 1: Create a template.json file with below code
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.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": {}
}
Step 2: Create a parameters.json file with below code
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"rgName": {
"value": "thewebspark-eastus2-dev"
},
"rgLocation": {
"value": "eastus2"
},
"tags": {
"value": {
"Blog ": "AzureSeries"
}
}
}
}
Step 3: Open cmd and run below azure cli command to deploy the ARM templates
$az deployment group create –resource-group thewebspark-eastus2-dev –template-file template.json –parameters parameters.json
You will get provisioningState as “Succeeded”
That is all for now, I will see you all in the part of Azure Series!
One thought on “Azure Series Part 1: Creating resource groups in Microsoft Azure”