Skip to content

Latest commit

 

History

History
62 lines (43 loc) · 2.84 KB

get-started-windows-powershell.md

File metadata and controls

62 lines (43 loc) · 2.84 KB
title description keywords ms.topic ms.date ms.custom adobe-target
Install Terraform on Windows with Azure PowerShell
Learn how to configure Terraform on Windows with Azure PowerShell
terraform azure cli devops powershell install configure windows interactive login rbac service principal automated script
how-to
06/20/2024
devx-track-terraform, mode-api, devx-track-azurecli, devx-track-azurepowershell
true

Install Terraform on Windows with Azure PowerShell

[!INCLUDE Terraform abstract]

This article describes how to get started with Terraform on Azure using PowerShell.

In this article, you learn how to:

[!div class="checklist"]

  • Install the latest version of PowerShell
  • Install the new PowerShell Az Module
  • Install the Azure CLI
  • Install Terraform
  • Understand common Terraform and Azure authentication scenarios
  • Authenticate via a Microsoft account from Cloud Shell (using Bash or PowerShell)
  • Authenticate via a Microsoft account from Windows (using Bash or PowerShell)
  • Create a service principal using the Azure CLI
  • Create a service principal using Azure PowerShell
  • Specify service principal credentials in environment variables
  • Specify service principal credentials in a Terraform provider block

1. Configure your environment

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

2. Install Azure PowerShell

  1. The latest PowerShell module that allows interaction with Azure resources is called the Azure PowerShell Az module. When using the Azure PowerShell Az module, PowerShell 7 (or later) is the recommended version on all platforms. If you have PowerShell installed, you can verify the version by entering the following command at a PowerShell prompt.

    $PSVersionTable.PSVersion
  2. Install PowerShell. This demo was tested using PowerShell 7.2.1 (x64) on Windows 10.

3. Install the Azure CLI

For Terraform to authenticate to Azure, you need to install the Azure CLI. This demo was tested using Azure CLI version 2.32.0.

4. Install Terraform for Windows

[!INCLUDE install-terraform-on-windows.md]

Troubleshoot Terraform on Azure

Troubleshoot common problems when using Terraform on Azure

Next steps

[!div class="nextstepaction"] Authenticate Terraform to Azure