BacklogZero®

Ansible in a Minute · Certified Collections ·

Create an Azure resource group

Short answer

Use azure.azcollection to create an Azure resource group in a chosen region.

Request

create azure resource group rg-app-prod in eastus

Example

A quick heads-up: Every environment is different. Review and test this example before you run it on systems you care about.

YAML
---
- name: Create an Azure resource group
  hosts: localhost
  gather_facts: false
  connection: local
  tasks:
    - name: Ensure resource group exists
      azure.azcollection.azure_rm_resourcegroup:
        name: rg-app-prod
        location: eastus
        state: present

How it works

azure_rm_resourcegroup creates or updates a resource group. Provide Azure credentials through the usual Azure Ansible authentication methods before you run the playbook.

When to use it

  • Creating a landing resource group for a new application
  • Keeping resource group names and regions in source control

Requirements

  • Collection: azure.azcollection
  • Technology: Microsoft Azure
  • azure.azcollection collection installed
  • Azure credentials available to Ansible

Validation

  • Syntax validated
  • Not execution-tested
  • Last verified 2026-09-09

Notes

Choose the region your organization standardizes on. Confirm naming conventions before you create shared subscription resources.

Try it with BacklogZero

Ask BacklogZero to generate this automation for your environment.

Get BacklogZero today

Related guides

Back to Ansible in a Minute

Create an Azure resource group · Level Up Labs