Prerequisites¶
Required Permissions¶
Microsoft Entra ID¶
| Permission | Scope | Purpose |
|---|---|---|
| EnvironmentManagement.Environments.Read | Power Platform API (delegated) | Enumerate environments when calling the Power Platform API directly; the bundled PowerShell scripts use Get-AdminPowerAppEnvironment, which relies on the Power Platform Administrator role below |
| Dynamics CRM user_impersonation | Delegated (interactive runs only) | Read/write Dataverse tables when a signed-in user runs the scripts. Not needed for app-only (managed identity, certificate, or workload identity) runs, which use a Dataverse application user instead |
Power Platform¶
| Role | Scope | Purpose |
|---|---|---|
| Power Platform Administrator | Tenant | Enumerate all environments |
| System Administrator | Dataverse org | Read bot table, write baselines/violations |
Azure Automation (Optional)¶
| Permission | Purpose |
|---|---|
| Automation Contributor | Import and manage runbook |
| Managed identity access | Recommended runtime authentication for Dataverse; register the managed identity's application (client) ID as a Dataverse application user. User-assigned identities are supported for Automation cloud jobs only |
| Certificate access | Fallback authentication when managed identity is not available |
Required Modules¶
PowerShell¶
# Install required modules
Install-Module -Name MSAL.PS -MinimumVersion 4.37.0 -Scope CurrentUser
Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Scope CurrentUser
Python¶
Required packages:
- msal>=1.30.0 — Microsoft Authentication Library for legacy interactive/client-secret fallback
- requests>=2.32.0 — HTTP client
- azure-identity>=1.23.0 — managed identity, workload identity, and developer credential chain
Microsoft Entra ID App Registration¶
- Navigate to Entra ID > App registrations > New registration
- Name:
FSI-FileUploadSecurity(or your naming convention) - Supported account types: Single tenant
- Add API permissions:
- Dynamics CRM:
user_impersonation(delegated; only needed for interactive sign-in) - Grant admin consent
- Create a certificate for non-interactive authentication:
- Upload the certificate public key (
.cer) to the app registration - For non-interactive (app-only) authentication, create a Dataverse application user for the app registration in each target environment and assign it a security role. The delegated
user_impersonationpermission does not apply to app-only access
Authentication Pattern¶
Use the strongest available identity option for the runtime:
- System-assigned managed identity for Azure Automation, Functions, or other Azure-hosted runners.
- User-assigned managed identity when a dedicated governance identity is required.
- Workload identity federation for GitHub Actions or other OIDC-capable CI runners.
- Interactive/developer credentials for one-off admin workstation runs.
- Client secret only as a legacy development fallback.
Environment Variables¶
Set these for CLI-based deployment:
| Variable | Description | Example |
|---|---|---|
FUS_DATAVERSE_URL |
Dataverse org URL | https://governance.crm.dynamics.com |
FUS_MANAGED_IDENTITY_CLIENT_ID |
Optional user-assigned managed identity client ID | 12345-abcd-... |
FUS_TENANT_ID |
Microsoft Entra ID tenant ID; required for interactive or legacy client-secret auth | contoso.onmicrosoft.com |
FUS_CLIENT_ID |
App registration client ID for interactive, workload identity, or legacy client-secret auth | 12345-abcd-... |
FUS_CLIENT_SECRET |
Legacy dev-only client secret; use managed identity in production | *** |
External Dependencies¶
Zone Classification¶
The zone classification logic (scripts/private/Get-ZoneClassification.ps1) is self-contained within this solution. It uses a two-tier approach:
- ELM Dataverse lookup (preferred) — queries the
fsi_acv_environmentregistrationstable when-DataverseUrland-AccessTokenare provided - Naming convention fallback — pattern-matches the environment display name when ELM data is unavailable
Unclassifiable environments default to Zone 1 (most restrictive) for fail-safe governance. To ensure accurate zone classification, pass -DataverseUrl to Get-AgentFileUploadSettings.
Network Requirements¶
| Endpoint | Protocol | Purpose |
|---|---|---|
login.microsoftonline.com |
HTTPS | Authentication |
*.crm.dynamics.com (regional variants such as *.crm4.dynamics.com) |
HTTPS | Dataverse API |
api.admin.powerplatform.microsoft.com |
HTTPS | Power Platform admin center service (listed on Learn's Power Platform URLs page) |
*.api.powerplatform.com |
HTTPS | Power Platform API (listed on Learn's Power Platform URLs page) |
api.bap.microsoft.com |
HTTPS | Power Platform admin (BusinessAppPlatform) API host; documented on Learn as the host for admin REST calls but not listed on the Power Platform URLs page. Which host Microsoft.PowerApps.Administration.PowerShell calls is not documented on Learn; keep this entry if your firewall policy requires it |
File Upload Security Configurator — Prerequisites — Last Verified: 2026-10-09