Create Azure Service Principal with Owner Role - azure-javaee/rhel-jboss-templates GitHub Wiki

#!/bin/bash  
# Login to Azure (if not already logged in) 
az login  

# Get subscription ID 

SUBSCRIPTION_ID=$(az account show --query id -o tsv)  

# Create service principal and capture output 
SP_OUTPUT=$(az ad sp create-for-rbac \     
  --name "hc050107" \     
  --role "Owner" \     
  --scopes "/subscriptions/$SUBSCRIPTION_ID" \     
  --sdk-auth \     
  --output json)  


echo "$SP_OUTPUT"