Create and use a service principal to deploy an Azure Red Hat OpenShift cluster
Article
To interact with Azure APIs, an Azure Red Hat OpenShift cluster requires a Microsoft Entra service principal. This service principal is used to dynamically create, manage, or access other Azure resources, such as an Azure load balancer or an Azure Container Registry (ACR). For more information, see Application and service principal objects in Microsoft Entra ID.
This article explains how to create and use a service principal to deploy your Azure Red Hat OpenShift clusters using the Azure command-line interface (Azure CLI) or the Azure portal.
The following sections explain how to create and use a service principal to deploy an Azure Red Hat OpenShift cluster.
Prerequisites - Azure CLI
If you’re using the Azure CLI, you’ll need Azure CLI version 2.30.0 or later installed and configured. Run az --version to find the version. If you need to install or upgrade, see Install Azure CLI.
Create a resource group - Azure CLI
Run the following Azure CLI command to create a resource group in which your Azure Red Hat OpenShift cluster will reside.
Azure CLI
AZ_RG=$(az group create -n test-aro-rg-l eastus2 --query name -o tsv)
Create a service principal and assign role-based access control (RBAC) - Azure CLI
To assign the contributor role and scope the service principal to the Azure Red Hat OpenShift resource group, run the following command.
Azure CLI
# Get Azure subscription ID
AZ_SUB_ID=$(az account show --query id -o tsv)
# Create a service principal with contributor role and scoped to the Azure Red Hat OpenShift resource group az ad sp create-for-rbac -n"test-aro-SP"--role contributor --scopes"/subscriptions/${AZ_SUB_ID}/resourceGroups/${AZ_RG}"
Note
Service principals must be unique per Azure RedHat OpenShift (ARO) Cluster.
This service principal only allows a contributor over the resource group the Azure Red Hat OpenShift cluster is located in. If your VNet is in another resource group, you need to assign the service principal contributor role to that resource group as well. You also need to create your Azure Red Hat OpenShift cluster in the resource group you created above.