Create and use environment variables
Unlock the complete study guide + 1,040 practice questions across 16 full exams.
Bundled into the existing Designing and Building Integrated AI Agent Solutions in Copilot Studio premium course — no separate purchase.
14-day money-back guarantee — no questions asked.
Included in this chapter:
- Where a value stops belonging to the agent
- Two records, one variable, and which value wins
- Picking the data type, and the label that is contested
- Data source variables are not connections
- Secret variables and the Azure Key Vault chain
- Reading an environment variable inside the agent
- When a changed value actually reaches the agent
- Getting values across the environment border
- What goes wrong with environment variables
- Where this page stops
The six environment variable data types, and what each one is actually for
| Data Type at creation | Type in Copilot Studio | What the variable holds | Reaches a published agent | Pick it when |
|---|---|---|---|---|
| Text | Text (maps to String) | A plain string value stored in Dataverse | At publish time; republish after a change | An endpoint, a portal address, a region code, any per-environment string |
| Decimal number | Decimal number (maps to Number) | A numeric value stored in Dataverse | At publish time; republish after a change | A retry count, a threshold, a numeric tuning value |
| Two options | Yes/No (maps to Boolean) | A two-state value stored in Dataverse | At publish time; republish after a change | A feature switch the agent branches on. The label differs between the two articles; see the page body |
| JSON | JSON (type detected from the value) | A structured value; a non-JSON value raises an Unspecified validation error | At publish time; republish after a change | Several related settings that always change together as one unit |
| Data source | Data source (maps to String) | Connector parameters such as a SharePoint site and list, or a SQL server and database. Never the credential | At publish time; republish after a change | A connector target that differs per environment and is reached with identity-based authentication |
| Secret | Secret (maps to String) | The subscription, resource group, vault, and secret name of an Azure Key Vault secret. Never the secret itself | At runtime; no republish needed, but the Dialog runtime caches a read for five minutes | A credential that must rotate independently of releases |
Decision tree
Cheat sheet
Unlock with Premium — includes all practice exams and the complete study guide.
Also tested in
References
- Use environment variables in Power Platform solutions - Power Apps
- Variables overview - Microsoft Copilot Studio
- Establish an Application Lifecycle Management (ALM) strategy - Microsoft Copilot Studio
- Use data source environment variables in canvas apps - Power Apps
- Use environment variables for Azure Key Vault secrets - Power Apps
- Work with variables - Microsoft Copilot Studio
- Key concepts - Publish and deploy your agent - Microsoft Copilot Studio