Skip to content

Latest commit

 

History

History
64 lines (42 loc) · 2.51 KB

authenticate-to-azure.md

File metadata and controls

64 lines (42 loc) · 2.51 KB
title description keywords ms.topic ms.date ms.custom
Authenticate Terraform to Azure
Learn the various options to authenticate to Azure with a Microsoft Account
azure devops terraform cli powershell authentication microsoft account subscription environment variables provider block
how-to
06/20/2024
devx-track-terraform

Authenticate Terraform to Azure

[!INCLUDE Terraform abstract]

To use Terraform commands against your Azure subscription, you must first authenticate Terraform to that subscription. This article covers some common scenarios for authenticating to Azure.

In this article, you learn how to:

[!div class="checklist"]

  • See a list of available authentication methods.
  • Select an authentication method.
  • Verify that you're authenticated.

1. Configure your environment

[!INCLUDE open-source-devops-prereqs-azure-subscription.md]

[!INCLUDE configure-terraform.md]

2. Authenticate Terraform to Azure

Terraform only supports authenticating to Azure with the Azure CLI. Authenticating using Azure PowerShell isn't supported. Therefore, while you can use the Azure PowerShell module when doing your Terraform work, you first need to authenticate to Azure using the Azure CLI.

3. Verify the results

Verify that you've authenticated to the Azure subscription by displaying the current subscription.

To confirm the current Azure subscription with the Azure CLI, run az account show.

az account show

To confirm the current Azure subscription with Azure PowerShell, run Get-AzContext.

Get-AzContext

Next steps

[!div class="nextstepaction"] Your first Terraform project: Create an Azure resource group