Creating resource group in Azure
In this blog we are going to create resource group which is one of fundamental component in Microsoft Azure.
What is a Resource group ?
To understand what is resource group we need to first understand what a resource means in Azure.
In Azure, the term resource refers to an entity managed by Azure. For example, virtual machines, virtual networks, and storage accounts are all referred to as Azure resources.
Each resource in Azure must belong to a resource group. A resource group is simply a logical construct that groups multiple resources together so they can be managed as a single entity based on lifecycle and security. For example, resources that share a similar lifecycle, such as the resources for an n-tier application may be created or deleted as a group. Put another way: everything that is born together, gets managed together, and deprecates together, goes together in a resource group.
For example: Think of an application that is composed of an App Service and a SQL DB. These can now be grouped together within a Resource Group which means it is easier to manage. If your application consists of a Virtual Machine then there will be several resources attached to it — Vnet, Network Cards, Storage, Public IP — and that is just for a single VM, if you have to load balance then you need to double that up and before you know it you have 10+ resources. Having these all grouped within a Resource Group makes managing the resources much easier.
Benefits of creating Resource group ?
- Granular permission: Permissions can be granted to each Resource Group, so other users can be granted access to only those resources that they need access to, and this can be restricted further by resource if required
- Detailed Billing: You can easily get comprehensive billing information for all the resources within the group, and thus for any particular application or service.
- Creating resource templates : You can export resource groups to templates, which can be reused to create similar other resource groups with same kind of resources that are part of the resource groups. This is can be beneficial in case we want to deploy new Dev / Test environment we can deploy it in moments with the same configuration as that of the previously deployed environment without much of manual efforts. This is also useful for Production environment, when you want exact same resources in different Azure regions — the same template can be run, just specifying different Region at the time of deployment.
Resource groups can be created by using the following methods:
- Azure portal
- Azure PowerShell
- Azure CLI
- Templates
- Azure SDKs (like .NET, Java)
We will be creating the resource group using Azure portal
Lets get started !
and create a new Resource group, we will be creating all the resources under this resource group so that clean up is done with out much pain.
Follow along steps to create a new resource group.
- Login to your Azure portal, after login you will land on the Dashboard page. Click the button “Create resources” on the dashboard. [ Highlighted in the below image ]
2. Type “Resource group” in the search box and hit enter.
3. You will land on the Resource group page,
4. Click on “Create” , you will be taken to creation page for resource group.
Enter your resource group name, let’s use practice-rg. Select the subscription it should be in, and select the region for the resource group. Select Review + Create and then Create to create the resource group.
5. Once your resource group is created you will be redirected to your dashboard with notification message “Resource group created”
That’s it, you’ve created a resource group that you can now use when you deploy Azure resources.
Let’s take a closer look at some important things to consider.
Use resource groups for organization
So how can you use resource groups to your advantage in your new organization? There are some guidelines and best practices that can help with the organization.
Consistent naming convention
You can start with using an understandable naming convention. We named our resource group practice-rg. We’ve given some indication of what it’s used for (practice), the types of resources contained within (core-infrastructure), and the type of resource it is itself (rg). This descriptive name gives us a better idea of what it is. If we had named it my-resource-group or rg1, we have no idea on a glance of what the usage may be. In this case, we can deduce that there are probably core pieces of infrastructure contained within. If we created additional VNets, storage accounts, or other resources the company may consider core infrastructure, we could place them here as well, to improve the organization of our resources. Naming conventions can vary widely between and even within companies, but some planning can help.
Organizing principles
Resource groups can be organized in a number of ways, let’s take a look at a few examples. We might put all resources that are core infrastructure into this resource group. But we could also organize them strictly by resource type. For example, put all VNets in one resource group, all virtual machines in another resource group, and all Azure Cosmos DB instances in yet another resource group.
We could organize them by environment (prod, qa, dev). In this case, all production resources are in one resource group, all test resources are in another resource group, and so on.
We could organize them by department (marketing, finance, human resources). Marketing resources go in one resource group, finance in another resource group, and HR in a third resource group.
We could even use a combination of these strategies and organize by environment and department. Put production finance resources in one resource group, dev finance resources in another, and the same for the marketing resources.
There are a few factors that can play into the strategy you use to organize resources: authorization, resource life cycle, and billing.
Organizing for authorization
Since resource groups are a scope of RBAC, you can organize resources by who needs to administer them. If your database administration team is responsible for managing all of your Azure SQL Database instances, putting them in the same resource group would simplify administration. You could give them the proper permissions at the resource group level to administer the databases within the resource group. Similarly, the database administration team could be denied access to the resource group with virtual networks, so they don’t inadvertently make changes to resources outside the scope of their responsibility.
Organizing for life cycle
We mentioned earlier that resource groups serve as the life cycle for the resources within it. If you delete a resource group, you delete all the resources in it. Use this to your advantage, especially in areas where resources are more disposable, like non-production environments. If you deploy 10 servers for a project that you know will only last a couple of months, you might put them all in a single resource group. One resource group is easier to clean up than 10 or more resource groups.
Organizing for billing
Lastly, placing resources in the same resource group is a way to group them for usage in billing reports. If you’re trying to understand how your costs are distributed in your Azure environment, grouping them by resource group is one way to filter and sort the data to better understand where costs are allocated.
P.S
For people who are trying to get there journey started with Microsoft Azure, they can sign up for free account which is also provided with limited free credits that can be utilized for spinning up some instances to get hands-on experience on the Azure.
Note:
1. These credits are available for only 1 month after which we need to upgrade to another subscriptions.
2. People new to the Azure platform can go through basic walk through on the components from following link.
3. People who wants to learn about Azure fundamentals can take the online self paced learning path provided by Microsoft azure for free. They also provide Sandbox within the course to perform hands-on activity. One useful link to switch in the sandbox provided by Microsoft.
(This course Azure fundamentals helped me to get started with Azure.)
Bibliography: docs.microsoft.com/en-us/