skip to Main Content

I have two azure application registrations which are used for authentication & authorization. I would like to know how I can export them into terraform code with keeping their settings and configurations. I have been checking Azure/Aztfexport however I could not export my existing app registrations. Is there a way to do this? If so, how?

This is one of the app registrations that I have for demo purpose:
enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    As per answer from aztfexport developers that you can find here:

    The azuread_application belongs to the azuread provider, while aztfexport currently only support azurerm resources and they didn't plan to support azuread at this moment as it is not ARM based, but uses MS Graph API.

    Which means it is currently not possible to export an azuread application registration as terraform code


  2. I have been checking Azure/Aztfexport however I could not export my existing app registrations. Is there a way to do this? If so, how?

    Yes, you can export an existing Azure AD Application to terraform.tfstate using the below Terraform code.

    Here is the Terraform code to export the Azure AD Application.

    provider "azurerm" {
      features {}
    }
    resource "azuread_application" "existingADapplicationname" {
    }
    output "azuread_application" {
      value = azuread_application.existingADapplicationname
    }
    

    Terraform Result.

    enter image description here

    terraform.tfstate

    enter image description here

    Reference: azuread_application

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search