DEV Community

Cover image for Resource Groups in Microsoft Azure
Lakshit Pant
Lakshit Pant

Posted on

Resource Groups in Microsoft Azure

In today's session, we dive into the fundamental concept of Azure Resource Groups—a pivotal aspect of Azure's top-down structure. Here's a breakdown to demystify Resource Groups from a cost management perspective.

Top-Down Approach: Azure Account, Subscriptions, Resource Groups, Resources

Top Down Approach

Imagine your company has an Azure Subscription with a monthly budget of $50,000. Setting up a Budget Alert at the Subscription level allows effective cost monitoring. Now, with four Departments—Accounts, Manufacturing, R&D, and Sales—permissions granted at any level inherit down the hierarchy.

orgs hierarchy

What is a Resource?

In Azure, a resource is an individual service like app service, Azure storage, or Azure Active Directory. Creating a new resource means deploying a specific Azure service.

Understanding Azure Resource Groups

Azure Resource Groups serve as containers that house multiple Azure services. They provide flexibility in managing the life cycle of services collectively. Key points to note:

  • Creation Methods: Azure Resource Groups can be created through various methods, including the Azure portal, Azure CLI, Azure PowerShell, and Azure ARM Templates.
  • Deployment Location: Each resource group has its deployment location to store metadata, irrespective of the services' deployment locations.
  • Unified Life Cycle: All services within a resource group share a similar life cycle—allowing for unified deletion, updating, and deployment.
  • Flexibility: Services can be moved between resource groups, providing flexibility in organizing and managing resources.
  • Metadata Constraints: Services with identical metadata cannot exist in different resource groups.
  • Cross-Region Deployment: Resource groups and resources can be in different regions, enhancing deployment flexibility.
  • Security Management: Resource groups offer control over the security of grouped services, including user access and resource permissions.
  • Interconnectivity: Resources within a resource group can seamlessly connect with each other.
  • Deployment Limit: Each resource group can deploy up to 800 services simultaneously.
  • Deletion Consequence: Deleting a resource group results in the deletion of all services contained within it.

Resources -

Resource Group using Azure CLI
https://learn.microsoft.com/en-us/cli/azure/manage-azure-groups-azure-cli

*Resource Group using Powershell *
https://learn.microsoft.com/en-us/powershell/module/az.resources/new-azresourcegroup?view=azps-11.2.0

_Now, before you start working with Powershell, make sure you're signed IN as a Admin, for this you can simply search Powershell & right click and then Run as a Administrator. This will gives you modify, update, write, build changes in the Powershell editor. _

Run these commands before applying any of the above command given for the Resource Group Creation -

Install-Module -Name Az -Force -AllowClobber -Scope CurrentUser

This PowerShell command installs the Azure PowerShell module named "Az" for the current user's session. Let's break down the components:

Install-Module: This cmdlet is used to install PowerShell modules. A module is a package that contains PowerShell cmdlets, providers, functions, workflows, aliases, and other resources.

-Name Az: Specifies the name of the module to be installed, in this case, "Az." The "Az" module is the recommended module for interacting with Microsoft Azure services using PowerShell.

-Force: This parameter is used to force the installation, even if a newer version of the module is already installed.

-AllowClobber: This parameter allows overwriting existing cmdlets in the current session with those from the module being installed. It helps in resolving conflicts and ensures that the latest version of cmdlets is available.

-Scope CurrentUser: Specifies that the module should be installed for the current user only. This means the module will be available in the current PowerShell session and does not require administrative privileges to install.

Import-Module Az

The command Import-Module Az is used in PowerShell to import the Az module. The Az module is the Azure PowerShell module, which provides cmdlets for managing and interacting with Microsoft Azure services through the PowerShell command-line interface.

Connect-AzAccount

The Connect-AzAccount command is used in Microsoft Azure PowerShell to authenticate and establish a connection between your PowerShell session and your Azure account. When you run this command, it prompts you to enter your Azure credentials (username and password) or use other authentication methods like a service principal or a managed identity.

Locks in Resource Groups

Resource groups support locks in conjunction with Azure RBAC (Role-Based Access Control), ensuring secure access management.

This comprehensive understanding of Azure Resource Groups sets the stage for effective resource organization and management in your Azure environment.

Stay tuned for more insights and practical tips in our 100 Days of Cloud journey!

Top comments (0)