Skip to content

powerplatform_analytics_data_export resource #486

@mattdot

Description

@mattdot

User Story

As a Terraform user, I want the powerplatform_analytics_data_export resource to configure the export of analytics / telemetry data from various power platform services to app insights or data lake.

Use case: [Describe specific scenario where this resource would be valuable in infrastructure automation]

Resource

Potential Terraform Configuration

# Sample Terraform config that describes how the new resource might look.

resource "powerplatform_analytics_data_export" "dataverse_to_appinsights" {
  name = "example"
  environment_id = "<guid>"
  provider = "CloudFlow" # Dataverse | CloudFlow | PowerApps

  # easy to use
  scenarios = {
    dataverse_dependencies_plugin_executions = true
    dataverse_dependencies_sdk_executions = false
    dataverse_exceptions_plugin_executions = false
  }

  # Alternative Approach ... easy to maintain
  scenarios = ["", "", ""]
   
  app_insights = {
        resource_group_name = ""
        resource_name = ""
        subscription_id=""
        app_insights_key=""
    }
}

resource "powerplatform_analytics_data_export" "powerapp_to_datalake" {
   provider = "PowerApps" # PowerApps | CloudFlow
   data_lake = {
      resource_group_name = ""
      resource_name = ""  # the storage account name
      azure_subscription_id=""
   }
}

Additional Validation Rules

  • Allow either data_lake or app_insights but not both in the same resource?

API documentation

Action Verb URL Status Codes Comments
Create POST https://na.csanalytics.powerplatform.microsoft.com/api/v1/sinks/lakes/connections 202 Datalake connections
Create POST https://na.csanalytics.powerplatform.microsoft.com/api/v2/sinks/appinsights/connections 202 AppInsights connections
Read GET https://na.csanalytics.powerplatform.microsoft.com/api/v1/connections 202 Datalake connections
Read GET https://na.csanalytics.powerplatform.microsoft.com/api/v2/connections 202 AppInsights connections
Delete DELETE https://na.csanalytics.powerplatform.microsoft.com/api/v1/sinks/Lakes/ids/<export_id>/sources/PowerAutomate 202 Datalake connections. export id is the full /subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.Storage/storageAccounts/<storage_account_name> and is URL encoded so slashes in the id show up as %2F
Delete DELETE https://na.csanalytics.powerplatform.microsoft.com/api/v2/sinks/AppInsights/sources/AppInsight/connection/<connection id> AppInsights connections

JSON

{
  "value": [
    {
      "source": "PowerAutomate",
      "sink": {
        "type": "Lakes",
        "id": "/subscriptions/<subscription_id>/resourceGroups/<resource_group>/providers/Microsoft.Storage/storageAccounts/<storage_account_name>",
        "resourceName": "<storage_account_name>"
      },
      "scenarios": null,
      "status": "Pending",
      "packageName": null
    }
  ]
}

Definition of Done

  • Data Transfer Objects (dtos) in dto.go
  • Resource Model in model.go
  • API Client functions in api_{name}.go
  • Resource Implementation in resource_{name}.go
  • Unit Tests in resource_{name}_test.go for Happy Path, Error conditions, boundry cases
  • Acceptance Tests in resource_{name}_test.go for Happy Path
  • Resource Added to provider.go and provider_test.go
  • Example in the /examples folder
  • Schema documented using MarkdownDescription
  • Change log entry changie new -k added
  • Run make precommit before PR

See the contributing guide for more information about what's expected for contributions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestresourceterraform resource

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions