Azure Series Part 1: Creating resource groups in Microsoft Azure

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

click on create

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

provide the name and the region

Step 3: Enter the tags if required

tags

Step 4: Review and Create the resource group

review and create

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

thewebspark-eastus2-dev

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

resource groups in portal

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s