powerplatform_environment (Resource)

This resource manages a PowerPlatform environment

A Power Platform environment is a space in which you can store, manage, and share your organization's business data, apps, chatbots, and flows. It also serves as a container to separate apps that may have different roles, security requirements, or target audiences. Each environment is created under an Azure Active Directory tenant and is bound to a geographic location. You can create different types of environments, such as production, sandbox, trial, or developer, depending on your license and permissions. You can also move resources between environments and set data loss prevention policies. A Power Platform environment can have zero or one Microsoft Dataverse database, which provides storage for your apps and chatbots. You can only connect to the data sources that are deployed in the same environment as your app or chatbot. For more information, you can check out the following links:

Known Limitations

  • Service principals can't create development type environments

Example Usage

terraform {
  required_providers {
    powerplatform = {
      source = "microsoft/power-platform"
    }
  }
}

provider "powerplatform" {
  use_cli = true
}

resource "powerplatform_environment" "development" {
  display_name     = "example_environment"
  location         = "europe"
  azure_region     = "northeurope"
  environment_type = "Sandbox"
  dataverse = {
    language_code     = "1033"
    currency_code     = "USD"
    domain            = "mydomain"
    security_group_id = "00000000-0000-0000-0000-000000000000"
  }
}

Schema

Required

  • display_name (String) Display name
  • environment_type (String) Type of the environment (Sandbox, Production etc.)
  • location (String) Location of the environment (europe, unitedstates etc.). Can be queried using the powerplatform_locations data source. The region of your Entra tenant may limit the available locations for Power Platform. Changing this property after environment creation will result in a destroy and recreation of the environment (you can use the prevent_destroy lifecycle metatdata as an added safeguard to prevent accidental deletion of environments).

Optional

  • azure_region (String) Azure region of the environment (westeurope, eastus etc.). Can be queried using the powerplatform_locations data source. This property should only be set if absolutely necessary like when trying to create an environment in the same Azure region as Azure resources or Fabric capacity. Changing this property after environment creation will result in a destroy and recreation of the environment (you can use the prevent_destroy lifecycle metatdata as an added safeguard to prevent accidental deletion of environments).
  • billing_policy_id (String) Billing policy id (guid) for pay-as-you-go environments using Azure subscription billing
  • dataverse (Attributes) Dataverse environment details (see below for nested schema)
  • timeouts (Attributes) (see below for nested schema)

Read-Only

  • id (String) Unique environment id (guid)

Nested Schema for dataverse

Required:

  • currency_code (String) Unique currency name
  • language_code (Number) Unique language LCID (integer)
  • security_group_id (String) Unique security group id (guid). For an empty security group, set this property to 0000000-0000-0000-0000-000000000000

Optional:

  • domain (String) Domain name of the environment
  • template_metadata (String) Additional D365 environment template metadata (if any)
  • templates (List of String) The selected instance provisioning template (if any)

Read-Only:

  • linked_app_id (String) The GUID of the linked D365 application
  • linked_app_type (String) The type of the linked D365 application
  • linked_app_url (String) The URL of the linked D365 application
  • organization_id (String) Unique organization id (guid)
  • url (String) Url of the environment
  • version (String) Version of the environment

Nested Schema for timeouts

Optional:

  • create (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
  • delete (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
  • read (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled.
  • update (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).

Import

Import is supported using the following syntax:

# Environment resource can be imported using the environment id (replace with a real environment guid)
terraform import powerplatform_environment.example 00000000-0000-0000-0000-000000000000