Azure: Authenticating to Azure using a Service Principal and a Client Secret

Azure Portal: Get all 4 Terraform authentication values

You can do this entirely through the Azure Portal web interface. No terminal commands or Azure CLI are required. Follow these steps in order.

Step 1 — Create the Terraform application

Exchange Online Integration for Email-Outbound from SAP ABAP Platform | Microsoft Learn

Open Microsoft Entra admin center.

  1. Select Entra ID → App registrations.
  2. Click New registration.
  3. Enter the name terraform-deployer.
  4. Select Accounts in this organizational directory only.
  5. Leave Redirect URI blank.
  6. Click Register.

If the application already exists, open it instead of creating another one.

Official guide: Register an application in Microsoft Entra ID.

Microsoft Learn

Step 2 — Get ARM_CLIENT_ID

On the newly created application’s Overview page:

Application (client) ID

Copy the displayed GUID

This is your ARM_CLIENT_ID.

Copy the actual ID displayed in your Azure Portal. Do not use the Object ID.

Step 3 — Get ARM_TENANT_ID

On the same Overview page, find:

Directory (tenant) ID

Copy the displayed GUID

This is your ARM_TENANT_ID.

You can also find it under Entra ID → Overview.

Step 4 — Create and get ARM_CLIENT_SECRET

Microsoft Teams configuration  |  Gemini Enterprise  |  Google Cloud Documentation

docs.cloud.google.com

  1. Open your terraform-deployer application.
  2. Select Certificates & secrets.
  3. Open Client secrets.
  4. Click New client secret.
  5. Enter a description, such as Terraform.
  6. Choose an expiration period.
  7. Click Add.
  8. Immediately copy the Value column.

Important

The client secret’s Value is your ARM_CLIENT_SECRET, not its Secret ID. Azure displays the value only once. If you leave the page without copying it, create a new secret.

Microsoft recommends certificates or federated credentials for production workloads rather than long-lived client secrets.

Microsoft Learn

Step 5 — Get ARM_SUBSCRIPTION_ID

How to find subscription ID from my azure account? - Microsoft Q&A
  1. Open Azure Portal.
  2. Search for Subscriptions.
  3. Select the subscription Terraform will manage.
  4. On the Overview page, copy Subscription ID.

This is your ARM_SUBSCRIPTION_ID.

Step 6 — Give the application permission to manage resources

Creating the application and secret does not automatically grant access to your Azure subscription.

  1. In Azure Portal, open Subscriptions.
  2. Select your subscription → Access control (IAM).
  3. Click Add → Add role assignment.
  4. Select Contributor.
  5. Click Next.
  6. Select User, group, or service principal as the member type.
  7. Click Select members and search for terraform-deployer.
  8. Select the application/service principal and click Review + assign.

You need permission to assign roles yourself. If Contributor is unavailable, an authorized subscription administrator may need to complete this step. Some Terraform configurations require additional permissions beyond Contributor.

Step 7 — Your four values are ready

ARM_CLIENT_ID

App registrations → your app → Overview → Application (client) ID

ARM_CLIENT_SECRET

Your app → Certificates & secrets → Client secrets → Value copied when created

ARM_TENANT_ID

Your app → Overview → Directory (tenant) ID

ARM_SUBSCRIPTION_ID

Azure Portal → Subscriptions → your subscription → Overview

Official Terraform reference: Authenticate the AzureRM Terraform provider using a service principal and client secret.

Terraform Registry

That’s it: All four values are obtained through the Azure Portal. You only need to use Terminal afterward if you want to configure them as environment variables for Terraform.

Related Posts

Terraform Lab – Azure –  Local Values and Outputs

Continuation of Labs 1–4 and Part 2 (All Six Input Variable Types)Level: Beginner → Early IntermediateTerraform: 1.15.9+ within version 1.xAzureRM provider: 5.9.x (same provider constraint as Part 2)Date: 12 October 2026…

Read More

Terraform Lab – Azure – Input Variables – VMS & Netowork Demo

Continuation of Labs 1–4 · Level: Beginner · Terraform: 1.15.9 · AzureRM: 5.9.x · Updated: 12 October 2026 Objective Terraform Lab – Azure – Resources – VMS & Netowork Demo Convert the final, consolidated Lab 4 infrastructure to…

Read More

Terraform Lab – Azure – Resources – VMS & Netowork Demo

Level: Absolute BeginnerTerraform version: 1.15.9AzureRM Provider: 5.9.0Approach: Each lab builds on the previous lab. These are four complete Terraform configurations designed for students to execute sequentially. Learning Path 1. Selected Azure…

Read More

Azure: Terraform Azure Authentication: Azure CLI

Latest Terraform Azure Authentication: Azure CLI The recommended approach in the HashiCorp AzureRM provider’s Azure CLI authentication guide is to authenticate through Azure CLI when running Terraform…

Read More

Azure: How to Create an Azure User, Assign Permissions, and Log In

Objective Create a new user in Microsoft Azure, grant access to cloud resources, and verify that the user can log in independently without sharing your administrator credentials….

Read More

Falcosidekick on Ubuntu: Complete Installation, Configuration, Alert Forwarding, and Troubleshooting Tutorial

I read your Falco: Zero to Intermediate – Gold-Standard Hands-on Master Tutorial. It uses Ubuntu Server 24.04 LTS as its reference lab and covers Falco installation, runtime…

Read More