As you know, you have been able to export your Azure deployment(s) or resource(s) into ARM templates using the Export template option.
Well, good news as now you can also use Terraform export
First thing first, you need to register the Microsoft.AzureTerraform provider either from the Azure portal, Azure Cli or PowerShell; you can also use Terraform
- Azure portal: from the Resource providers blade of the subscription, search for Microsoft.AzureTerraform
- PowerShell: use the below code
Register-AzResourceProvider -ProviderNamespace Microsoft.AzureTerraform
- Cli: use the below code
az provider register -n Microsoft.AzureTerraform
- Terraform: use the below Hashicorp code
resource “azurerm_resource_provider_registration” “azureterraform” {
name = “Microsoft.AzureTerraform”
}
Once done you can use either Azure Export Terraform tool, Azure portal, PowerShell or Cli
- Azure Export Terraform tool references Overview of Azure Export for Terraform | Microsoft Learn
- Portal: from the Automation\Export template blade
- PowerShell references Az.Terraform Module | Microsoft Learn
- Azure Cli reference az terraform | Microsoft Learn