Search code examples
azureterraformazure-active-directory

Where can I find Azure service principal credentials for Terraform environment variables?


I have created a variable group ins Azure Devops that I want to use to authenticate Terraform with Azure enter image description here

I had this working previously but the credentials have expired. I'm having trouble mapping the values I find in Azure with these four values.

enter image description here enter image description here

I'm reasonably confident that ARM_CLIENT_ID is the "Application (client) ID The ARM_CLIENT_SECRET is the "Value" from the client secret ARM_TENANT_ID is the "Directory (tenant) ID"

What should the ARM_SUBSCRIPTION_ID map to? I've tried mapping it to the Object ID and the Secret ID shown in the two screenshots but neither worked.

What maps to what?


Solution

  • To get the value of ARM_SUBSCRIPTION_ID variable, follow this:

    Go to Azure Portal -> Subscriptions -> Select your subscription -> Overview -> Subscription ID

    enter image description here

    You are right in fetching values of other variables like ARM_CLIENT_ID and ARM_TENANT_ID :

    enter image description here

    You can find value of ARM_CLIENT_SECRET variable here:

    enter image description here