Feature Flags in Power Platform allow you to enable or disable experimental, preview, or hidden features in your environments. Using PowerShell, you can manage these feature flags efficiently to control the behavior of your Power Platform environments.
Why Enable Feature Flags?
✔ Early access to preview features
✔ Enable hidden capabilities for testing
✔ Control environment-specific settings
✔ Automate feature activation across multiple environments
Step 1: Prerequisites
1.1 Install Required PowerShell Modules
Ensure that the Power Platform PowerShell modules are installed:
Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Force
Install-Module -Name Microsoft.PowerApps.PowerShell -Force
1.2 Authenticate to Power Platform
Sign in to Power Platform using:
Add-PowerAppsAccount
1.3 List Available Environments
Identify the environment name where you want to enable feature flags:
Get-AdminPowerAppEnvironment | Select-Object DisplayName, EnvironmentName
Example Output:
DisplayName EnvironmentName
------------ -----------------------------
DevelopmentEnv abcdef12-3456-7890-abcd-ef1234567890
TestingEnv 12345678-90ab-cdef-1234-567890abcdef
ProductionEnv fedcba98-7654-3210-fedc-ba9876543210
Step 2: Listing Available Feature Flags
Before enabling a feature, check the list of available feature flags in an environment.
$environmentName = "abcdef12-3456-7890-abcd-ef1234567890"
Get-AdminPowerAppEnvironmentFeatures -EnvironmentName $environmentName
Example Output:
FeatureName Status
------------------------------- ------------
PreviewDataverseAPIs Disabled
AIBuilderAutoFill Enabled
CoPilotEnhancedModeling Disabled
Step 3: Enabling a Feature Flag
To enable a feature in Power Platform, use the following command:
$featureName = "PreviewDataverseAPIs"
Set-AdminPowerAppEnvironmentFeature -EnvironmentName $environmentName -FeatureName $featureName -Enabled $true
This enables the Dataverse Preview APIs in the specified environment.
Step 4: Verifying the Change
Confirm that the feature has been enabled:
Get-AdminPowerAppEnvironmentFeatures -EnvironmentName $environmentName | Where-Object {$_.FeatureName -eq "PreviewDataverseAPIs"}
Expected Output:
FeatureName Status
------------------------------- ------------
PreviewDataverseAPIs Enabled
Step 5: Automating Feature Flag Enablement
To automate the process, use the following PowerShell script:
Feature Flag Automation Script (Enable-FeatureFlags.ps1)
param (
[string]$environmentName = "abcdef12-3456-7890-abcd-ef1234567890",
[string]$featureName = "PreviewDataverseAPIs"
)
# Authenticate
Add-PowerAppsAccount
# Enable Feature Flag
Set-AdminPowerAppEnvironmentFeature -EnvironmentName $environmentName -FeatureName $featureName -Enabled $true
Write-Host "Feature '$featureName' has been enabled in environment '$environmentName'."
Save this script and run it using:
powershell.exe -File "C:\Scripts\Enable-FeatureFlags.ps1"
Step 6: Scheduling Automatic Feature Flag Activation
Using Task Scheduler
- Open Task Scheduler (
taskschd.msc
). - Click Create Basic Task → Name it Enable Power Platform Feature Flags.
- Set Trigger to run weekly or daily.
- Select Start a Program and enter: arduinoCopyEdit
powershell.exe -File "C:\Scripts\Enable-FeatureFlags.ps1"
- Click Finish.
Now, feature flags will be automatically enabled on schedule.
Step 7: Enabling Feature Flags Across Multiple Environments
If you want to enable the feature in multiple environments, use this script:
$environments = @("abcdef12-3456-7890-abcd-ef1234567890", "12345678-90ab-cdef-1234-567890abcdef", "fedcba98-7654-3210-fedc-ba9876543210")
$featureName = "PreviewDataverseAPIs"
Add-PowerAppsAccount
foreach ($env in $environments) {
Set-AdminPowerAppEnvironmentFeature -EnvironmentName $env -FeatureName $featureName -Enabled $true
Write-Host "Feature '$featureName' enabled in environment '$env'."
}
This script enables PreviewDataverseAPIs in Development, Testing, and Production.