No description
  • Go 98.9%
  • Shell 0.7%
  • Makefile 0.2%
  • HCL 0.2%
Find a file
OpenTofu Core Development Team a03a0a0fd7 Apply GitHub workflow changes
2026-02-20 00:48:17 +00:00
.github Apply GitHub workflow changes 2026-02-20 00:48:17 +00:00
.release remove some TODO comments 2025-04-30 10:09:23 +02:00
.teamcity Update headers to new standard (#1831) 2026-01-21 13:07:48 -08:00
docs azuread_group / azuread_group_without_members - add deadline to context for CustomizeDiff (#1846) 2026-02-19 11:12:32 -07:00
examples apply fmt for examples (#1767) 2025-09-15 09:25:56 -06:00
internal azuread_group / azuread_group_without_members - add deadline to context for CustomizeDiff (#1846) 2026-02-19 11:12:32 -07:00
META.d Add CODEOWNERS & META.d (#1533) 2024-10-17 09:23:54 -07:00
scripts CHANGELOG.md for v3.1.0 (#1588) 2025-01-16 16:37:58 +01:00
vendor dependencies - update go to version 1.25.5 and misc dependencies. (#1842) 2026-02-16 16:45:31 +01:00
version CHANGELOG for v3.8.0 (#1840) 2026-02-19 13:12:36 -07:00
.copywrite.hcl copywrite config 2024-05-08 17:39:55 +01:00
.gitattributes Fix text mangling for vendored files 2021-05-20 00:19:09 +01:00
.gitignore chore: .devcontainer/ to gitignore 2023-01-12 13:43:17 +00:00
.go-version dependencies - update go to version 1.25.5 and misc dependencies. (#1842) 2026-02-16 16:45:31 +01:00
.golangci.yml update Go version to 1.24.1 (#1675) 2025-03-25 17:21:39 +01:00
CHANGELOG.md CHANGELOG for v3.8.0 (#1840) 2026-02-19 13:12:36 -07:00
CODEOWNERS Update CODEOWNERS (#1572) 2024-11-19 10:44:08 -08:00
GNUmakefile azuread_conditional_access_policy - add client_applications.filter (#1744) 2025-08-01 08:00:10 -06:00
go.mod dependencies - update go to version 1.25.5 and misc dependencies. (#1842) 2026-02-16 16:45:31 +01:00
go.sum dependencies - update go to version 1.25.5 and misc dependencies. (#1842) 2026-02-16 16:45:31 +01:00
LICENSE [COMPLIANCE] Update MPL 2.0 LICENSE (#907) 2022-10-12 14:12:56 -07:00
main.go Update headers to new standard (#1831) 2026-01-21 13:07:48 -08:00
README.md README: update slack invite link (#1847) 2026-02-19 14:45:47 -07:00
staticcheck.conf update linting to use staticcheck instead of unused and megacheck 2019-01-21 16:37:43 -08:00
terraform-registry-manifest.json Migrate to GitHub Actions based releases 2022-04-08 02:31:26 +01:00

Terraform logo

Terraform Provider for Azure Active Directory

NOTE: Version 1.0 and above of this provider requires Terraform 0.12 or later.

Usage Example

# Configure Terraform
terraform {
  required_providers {
    azuread = {
      source  = "hashicorp/azuread"
      version = "~> 2.7.0"
    }
  }
}

# Configure the Azure Active Directory Provider
provider "azuread" {

  # NOTE: Environment Variables can also be used for Service Principal authentication
  # Terraform also supports authenticating via the Azure CLI too.
  # See official docs for more info: https://registry.terraform.io/providers/hashicorp/azuread/latest/docs

  # client_id     = "..."
  # client_secret = "..."
  # tenant_id     = "..."
}

# Retrieve domain information
data "azuread_domains" "example" {
  only_initial = true
}

# Create an application
resource "azuread_application" "example" {
  name = "ExampleApp"
}

# Create a service principal
resource "azuread_service_principal" "example" {
  application_id = azuread_application.example.application_id
}

# Create a user
resource "azuread_user" "example" {
  user_principal_name = "ExampleUser@${data.azuread_domains.example.domains.0.domain_name}"
  display_name        = "Example User"
  password            = "..."
}

Further usage documentation is available on the Terraform website.

Developer Requirements

  • Terraform 0.12.x or later
  • Go 1.16.x (to build the provider plugin)

If you're building on Windows, you will also need:

For GNU32 Make, make sure its bin path is added to your PATH environment variable.

For Git Bash for Windows, at the step of "Adjusting your PATH environment", please choose "Use Git and optional Unix tools from Windows Command Prompt".

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.16+ is required). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin to your $PATH.

Clone the repository to: $GOPATH/src/github.com/hashicorp/terraform-provider-azuread

$ mkdir -p $GOPATH/src/github.com/terraform-providers; cd $GOPATH/src/github.com/terraform-providers
$ git clone https://github.com/hashicorp/terraform-provider-azuread

Change to the clone directory and run make tools to install the dependent tooling needed to test and build the provider.

To compile the provider, run make build. This will build the provider and put the provider binary in the $GOPATH/bin directory.

$ make tools
...
$ make build
...
$ $GOPATH/bin/terraform-provider-azuread
...

To compile the provider for attached debugging run make debug.

$ make debug
...
Provider started. To attach Terraform CLI, set the TF_REATTACH_PROVIDERS environment variable with the following:
    TF_REATTACH_PROVIDERS='{"registry.terraform.io/hashicorp/azuread":{"Protocol":"grpc","ProtocolVersion":5,"Pid":16227,"Test":true,"Addr":{"Network":"unix","String":"/var/folders/dy/r91ps1bx7fscm_v64qbwd0nh0000gn/T/plugin1540622971"}}}'

See the documentation for attaching a debugger.

In order to test the provider, you can simply run make test.

$ make test

The majority of tests in the provider are Acceptance Tests - which provisions real resources in Azure. It's possible to run the entire acceptance test suite by running make testacc - however it's likely you'll want to run a subset, which you can do using a prefix, by running:

make testacc TESTARGS='-run=TestAccApplication'

The following ENV variables must be set in your shell prior to running acceptance tests:

  • ARM_CLIENT_ID
  • ARM_CLIENT_SECRET
  • ARM_TENANT_ID
  • ARM_TEST_LOCATION
  • ARM_TEST_LOCATION_ALT

NOTE: Acceptance tests create real resources, and may cost money to run.