Create an Azure SDK secret to store service principal credentials for authenticating workloads with Azure services.
Azure SDK secrets store Azure service principal credentials, enabling your workloads to authenticate with Azure services using the Azure SDK. Use them for accessing Azure Storage, Key Vault, Cosmos DB, or any Azure resource.
Create a service principal using the Azure CLI: az ad sp create-for-rbac --name "my-app" --role contributor --scopes /subscriptions/{subscription-id}If you don’t have the Azure CLI installed locally, you can run the command in Azure Cloud Shell — a browser-based shell with az preinstalled and authenticated against your signed-in account.
Use the Azure CLI to create a service principal. If you don’t have the Azure CLI installed locally, you can run the command in Azure Cloud Shell without a local install:
# Create service principal with Contributor roleaz ad sp create-for-rbac \ --name "my-control-plane-app" \ --role contributor \ --scopes /subscriptions/{subscription-id}# Output includes:# {# "appId": "00000000-0000-0000-0000-000000000000", <- clientId# "displayName": "my-control-plane-app",# "password": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", <- clientSecret# "tenant": "00000000-0000-0000-0000-000000000000" <- tenantId# }
Use the principle of least privilege. Assign only the roles your workload needs, scoped to specific resources when possible.