Skip to main content
This page provides an index to all example Terraform configurations available in the provider repository. These examples demonstrate real-world usage patterns for resources, data sources, actions, and other provider features.
All examples are available in the examples directory of the GitHub repository.

Provider Configuration

Basic Provider Setup

Example provider configurations for different authentication methods and cloud environments:

Client Secret Authentication

Basic provider configuration with client secret

Certificate Authentication

Provider setup with certificate-based authentication

Managed Identity

Azure Managed Identity configuration

Government Cloud

Configuration for US Government Cloud (GCC/GCC High)

Resources

Examples for managing Microsoft 365 resources:

Device Management (Intune)

Application Management

Identity & Access Management

Windows 365 (Cloud PC)

Data Sources

Examples for querying Microsoft 365 data:

Device Management Data Sources

Application Data Sources

Identity Data Sources

Utility Data Sources

Actions (Remote Device Operations)

Examples for performing actions on managed devices:

Device Actions

Security Actions

Autopilot Actions

List Resources

Examples for listing and filtering resources:

Using the Examples

Running Examples Locally

1

Clone the Repository

git clone https://github.com/deploymenttheory/terraform-provider-microsoft365.git
cd terraform-provider-microsoft365/examples
2

Choose an Example

Navigate to the example you want to use:
cd resources/microsoft365_graph_beta_device_management_windows_update_ring
3

Configure Provider Authentication

Set up your provider configuration with appropriate credentials:
provider "microsoft365" {
  tenant_id     = var.tenant_id
  client_id     = var.client_id
  client_secret = var.client_secret
}
4

Initialize and Apply

terraform init
terraform plan
terraform apply
Examples may create real resources in your Microsoft 365 tenant. Always review the configuration and use a test tenant when trying examples.

Contributing Examples

When adding new resources to the provider, please include:
  • Basic usage example
  • Advanced configuration example (if applicable)
  • Import example
  • Comments explaining key configuration options
See the Contributing Guide for more information.

Build docs developers (and LLMs) love