azure cli subscription create

Azure CLI: Quickly Create or Manage Azure Subscriptions

By Joshua Davis
AD

Embarking on your Azure journey often starts with the creation of your first subscription. The Azure CLI (Command Line Interface) provides a powerful and efficient way to manage Azure resources, including the creation of new subscriptions. The 'azure cli subscription create' command is a core function that enables you to set up a new subscription, tailored to your organization's needs.

The command, in its basic form, is: `az account subscription create --name --state `. This command, when executed, will create a new subscription with the specified name and state (enabled or disabled). Let's delve into the details and functionalities of this command.

Understanding the 'az account subscription create' Command

The 'az account subscription create' command is part of the 'az account' subcommand, which focuses on managing Azure subscription-related tasks. This command, as mentioned, creates a new Azure subscription with the provided name and state.

AD
a family tree is shown with several different types of items in the same area, including two
a family tree is shown with several different types of items in the same area, including two
GitHub - Azure-Samples/azure-cli-samples: Contains Azure CLI scripts samples used for documentation at https://docs.microsoft.com
GitHub - Azure-Samples/azure-cli-samples: Contains Azure CLI scripts samples used for documentation at https://docs.microsoft.com
a blue and white poster with the words azure cli commands on it's side
a blue and white poster with the words azure cli commands on it's side

Before you create a subscription, ensure you are logged in to your Azure account using the 'az login' command. If you're not, the 'az account subscription create' command will fail.

Creating a Subscription with the Command

To create a new subscription, you need to provide a name for the subscription and specify its initial state. The name should be unique within your organization, and the state can either be 'enabled' or 'disabled'.

an image of a computer screen with the word azure in blue and green on it
an image of a computer screen with the word azure in blue and green on it
Azure CLI Cheat Sheet — Resource Groups & VM Reference
Azure CLI Cheat Sheet — Resource Groups & VM Reference
Announcing IoT extension for Azure CLI 2.0 | Microsoft Community Hub
Announcing IoT extension for Azure CLI 2.0 | Microsoft Community Hub

For example, the command `az account subscription create --name "MyFirstSubscription" --state "enabled"` will create a new subscription named "MyFirstSubscription" and set it to the enabled state.

Additional Parameters for Customization

While the basic command only requires a name and state, you can also add additional parameters for further customization. For instance, you can specify the location (--location), display name (--display-name), and even the resource group (--resource-group) in which to create the subscription.

AD

For instance, the command `az account subscription create --name "MyFirstSubscription" --state "enabled" --location "West Europe"` will create a new subscription named "MyFirstSubscription" in the "West Europe" region.

Azure Basics Explained Simply ☁️ | Microsoft Azure Cloud Services
Azure Basics Explained Simply ☁️ | Microsoft Azure Cloud Services
the azure logo on a blue background with white letters and an arrow in the middle
the azure logo on a blue background with white letters and an arrow in the middle
the azure cloud mindmap diagram
the azure cloud mindmap diagram
Create and Deploy Azure Function Apps in Visual Studio 2022
Create and Deploy Azure Function Apps in Visual Studio 2022
Create Azure Function in C# Script and Service Bus
Create Azure Function in C# Script and Service Bus
Creating Azure for Students Account
Creating Azure for Students Account

Role-Based Access Control (RBAC) and Subscriptions

Azure uses RBAC to manage access to Azure resources. When you create a new subscription, it's crucial to understand the roles and permissions associated with it.

For example, you might want to assign a specific role to a user or a group on the newly created subscription. This can be achieved using the 'az role assignment create' command.

AD

Assigning Roles to the Subscription

To assign a role, you need to know the Azure ID associated with the user or group. You can use the 'az ad user get' command to get the user's Azure ID or the 'az ad group get' command to get the group's Azure ID.

Multiple output in Azure Functions with C#
Multiple output in Azure Functions with C#
Azure Integration Services for Business Modernization
Azure Integration Services for Business Modernization
the azure logo on top of a blue cloud
the azure logo on top of a blue cloud
Integrate GPT Models with Azure OpenAI Service
Integrate GPT Models with Azure OpenAI Service
Choose an Azure Compute Service - Azure Architecture Center
Choose an Azure Compute Service - Azure Architecture Center
Analyzing Text Moderation using Azure Content Safety
Analyzing Text Moderation using Azure Content Safety
azure template drawio
azure template drawio
Enable your Azure subscription for Data Lake Store - Part One
Enable your Azure subscription for Data Lake Store - Part One
Terraform On Azure - Creating A WebApp
Terraform On Azure - Creating A WebApp
How To Move Azure Resources Between Existing Subscription To New Subscription
How To Move Azure Resources Between Existing Subscription To New Subscription

The 'az role assignment create' command then looks like `az role assignment create --assignee --role `.

For instance, `az role assignment create --assignee --role "Owner"` will add the specified user as an owner of the subscription.

AD

Using Parameters for Easier Role Assignment

The 'az role assignment create' command also supports parameters. You can use these parameters to provide additional information, such as the scope or the object ID of the assignment.

For example, `az role assignment create --assignee --role "Contributor" --scope /subscriptions/` will create a new role assignment for the contributor role for the specified user or group on the specified subscription ID.

In your Azure journey, understanding and effectively using the 'azure cli subscription create' command is a significant milestone. It enables you to create subscriptions tailored to your organization's needs and manage access to them using Role-Based Access Control. Now you're ready to explore and manage more Azure services and resources.

AD