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

AWS CodeCommit – Complete Step-by-Step Tutorial

Beginner to Advanced | macOS, Linux, Git, SSH, IAM, CodeBuild This master tutorial covers the complete AWS CodeCommit workflow, from creating your first repository to managing source…

Read More

AWS Developer Services: Console Lab Guide

title AWS Developer Services: Gold-Standard Console Lab Guide subtitle CodeCommit • CodeArtifact • CodeBuild • CodeDeploy • CodePipeline author Instructor Edition | Browser-Only Labs date 10 November…

Read More

Oracle Cloud Always Free VPS — Complete Step-by-Step Tutorial

Beginner to Advanced | Updated: November 2, 2026 | Verified against official Oracle Cloud Infrastructure documentation This guide walks you through logging in to Oracle Cloud, configuring…

Read More

Microsoft Sentinel Intermediate: One Complete End-to-End Hands-On Lab – Part – 3

Module 2: Intermediate | Day 3 only | Complete instructor-and-learner manual Edition: 1 November 2026Course: Microsoft Sentinel Technical Training — 5-day progressive curriculumThis document: Day 3 only; prerequisite: successful completion of Foundations…

Read More

Microsoft Sentinel Advance: One Complete End-to-End Hands-On Lab – Part – 4

Module 3: Advanced | Day 4 only | Detection Engineering, Threat Hunting and SOAR Curriculum version: 1 November 2026Course: Five-day progressive Microsoft Sentinel technical trainingThis manual: Day 4 only — syllabus competencies A01–A14Prerequisite: Demonstrated…

Read More

Microsoft Sentinel Advance: One Complete End-to-End Hands-On Lab – Part – 5

Module 3: Advanced | Day 5 only | Enterprise Architecture, Data Lake, DevSecOps and SOC Governance Edition: 1 November 2026Training path: Day 5 of the five-day progressive Microsoft Sentinel programThis manual: Day…

Read More