Tag: Application Lifecycle Management

Create and use environment variables (AB-620 Exam Prep)

This post is a part of the AB-620: Designing and Building Integrated AI Agent Solutions in Copilot Studio Exam Prep Hub.
This topic falls under these sections:
Test and manage agents (20–25%)
   --> Implement application lifecycle management (ALM) for agents in Copilot Studio
      --> Create and use environment variables (in Microsoft Copilot Studio
)

Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

As organizations move Copilot Studio agents from development to testing and production, many configuration settings change between environments. For example:

  • API endpoints
  • Azure AI Search service names
  • Azure OpenAI or Azure AI Foundry resources
  • Dataverse URLs
  • SQL Server connection information
  • SharePoint sites
  • REST API base URLs
  • Storage account names
  • Feature flags

Hardcoding these values into an agent or Power Automate flow creates deployment challenges because developers must manually edit every component for each environment.

Environment variables solve this problem by allowing configuration values to be stored separately from the application. Components reference the environment variable rather than a fixed value. When the solution is imported into another environment, only the environment variable needs to be updated.

For the AB-620 exam, you should understand:

  • What environment variables are
  • Why they are important for ALM
  • Types of environment variables
  • How to create them
  • How to use them in Copilot Studio
  • How they work with solutions
  • Their relationship to connection references
  • Best practices for deployment

What Are Environment Variables?

An environment variable is a reusable configuration setting stored within a Power Platform solution.

Instead of embedding configuration values directly into application components, the components reference an environment variable.

Example:

Instead of:

https://dev-api.contoso.com

An agent references:

API_BaseURL

Each environment supplies its own value.


Why Environment Variables Matter

Organizations usually have multiple environments:

  • Development
  • Test
  • User Acceptance Testing (UAT)
  • Staging
  • Production

Each environment typically uses different resources.

Example:

EnvironmentAPI URL
Developmenthttps://dev-api.contoso.com
Testhttps://test-api.contoso.com
Productionhttps://api.contoso.com

Without environment variables, every component would need to be edited during deployment.

With environment variables:

  • The solution remains unchanged.
  • Only the variable value changes.

Benefits of Environment Variables

Environment variables provide:

  • Easier deployments
  • Reusable configuration
  • Improved portability
  • Reduced manual work
  • Better governance
  • Fewer deployment errors
  • Cleaner application design
  • Improved ALM support

Environment Variables vs Hardcoded Values

Hardcoded Configuration

Agent

https://dev-api.company.com

Problems:

  • Difficult migration
  • Manual editing
  • Error-prone
  • Poor ALM

Environment Variable Configuration

Agent

API_URL

Environment Variable

Current Environment Value

Benefits:

  • Flexible
  • Reusable
  • Easy deployment

Common Uses

Environment variables commonly store:

  • REST API endpoints
  • Azure AI Search service names
  • Azure OpenAI endpoints
  • Azure AI Foundry endpoints
  • Azure Storage account names
  • Dataverse URLs
  • SharePoint URLs
  • Cosmos DB endpoints
  • SQL Server names
  • Feature toggles
  • Default language settings
  • Prompt configuration values

Types of Environment Variables

Power Platform supports two primary pieces of information:

Environment Variable Definition

The definition contains:

  • Variable name
  • Display name
  • Description
  • Data type
  • Default value

Example:

SearchServiceName

Environment Variable Value

The value changes by environment.

Development

contoso-search-dev

Testing

contoso-search-test

Production

contoso-search-prod

Supported Data Types

Environment variables support several data types.

Common types include:

  • Text
  • Decimal number
  • Two options (Boolean)
  • JSON
  • Data source
  • Secret (when integrated with Azure Key Vault)

The appropriate type depends on the configuration being stored.


Secrets and Azure Key Vault

Sensitive information should not be stored as plain text.

Examples include:

  • API keys
  • Client secrets
  • Access tokens
  • Passwords

Instead:

Environment Variable

Azure Key Vault Secret

Application

This approach improves security and simplifies secret rotation.


Creating an Environment Variable

General steps:

  1. Open the Power Apps Maker Portal.
  2. Open an unmanaged solution.
  3. Select New.
  4. Choose Environment Variable.
  5. Enter:
    • Display Name
    • Schema Name
    • Data Type
    • Default Value (optional)
  6. Save.

The variable is now available within the solution.


Using Environment Variables in Copilot Studio

Once created, environment variables can be referenced by:

  • Copilot Studio agents
  • Power Automate flows
  • Custom connectors
  • Plugins
  • Dataverse components
  • AI prompts
  • REST API tools
  • Azure integrations

Instead of storing a literal value, components reference the variable.


Example

Without environment variables:

REST API
https://dev-api.contoso.com/orders

With environment variables:

API_URL
https://dev-api.contoso.com

The REST action builds the URL dynamically.


Environment Variables During Deployment

When exporting a solution:

Environment Variable Definition

Solution Package

Import

Administrator enters Production Value

Application works without modification

No changes to the agent are required.


Relationship to Solutions

Environment variables are solution components.

This means they:

  • Export with the solution
  • Import with the solution
  • Support versioning
  • Participate in ALM
  • Work with managed solutions
  • Work with Power Platform Pipelines

Environment Variables and Connection References

These concepts are commonly confused.

Environment Variables

Store:

Configuration values

Examples:

  • URL
  • Service name
  • Feature flag
  • Search index
  • Region

Connection References

Store:

Authentication information

Examples:

  • SQL connection
  • SharePoint connection
  • Dataverse connection
  • Outlook connection

Think of it this way:

Environment Variable = What system should be used?

Connection Reference = How do I authenticate to that system?


Working with Power Platform Pipelines

Power Platform Pipelines automatically support environment variables.

Deployment process:

Development

Export Solution

Pipeline

Import

Assign Production Variable Values

Application Ready

No manual editing of the agent is required.


Versioning

Environment variables participate in solution versioning.

Example:

Version 1.0

SearchServiceName

Version 1.1

SearchServiceName
New Variable:
FeatureToggle

Both variables become part of the upgraded solution.


Common Mistakes

Hardcoding URLs

Instead of:

https://company-dev-api.com

Use:

API_URL

Storing Secrets as Text

Never place passwords directly into text variables.

Use Azure Key Vault integration whenever possible.


Duplicating Variables

Avoid creating multiple variables for the same setting.

Instead, reuse existing variables.


Poor Naming

Avoid names like:

Variable1

Prefer:

AzureSearchEndpoint

or

OrdersAPIBaseURL

Ignoring Default Values

Default values can simplify development and testing while allowing administrators to override values during deployment.


Best Practices

Microsoft recommends:

  • Create environment variables inside solutions.
  • Use descriptive names.
  • Use environment variables instead of hardcoded values.
  • Store secrets in Azure Key Vault.
  • Separate configuration from application logic.
  • Reuse variables whenever possible.
  • Document each variable.
  • Test variable values after deployment.
  • Use connection references for authentication.
  • Use environment variables for configuration settings.

Exam Tips

Know the difference between:

ConceptStores
Environment VariableConfiguration values
Connection ReferenceAuthentication information
Managed SolutionProduction deployment
Unmanaged SolutionDevelopment
Azure Key VaultSecrets

Remember:

Environment variables make solutions portable.


Real-World Example

A company builds a customer support agent that uses:

  • Azure AI Search
  • REST APIs
  • SharePoint
  • SQL Server

Instead of hardcoding configuration:

https://dev-search.azure.com
https://dev-orders-api.com
https://dev.sharepoint.com

The solution defines:

  • SearchServiceURL
  • OrdersAPI
  • SharePointSite

During deployment to production, administrators simply update the environment variable values without modifying the agent, topics, flows, or connectors.


Summary

Environment variables are a foundational ALM feature in Microsoft Power Platform and Copilot Studio. They allow developers to separate configuration settings from application logic, making solutions easier to deploy, maintain, and version across development, test, and production environments. By storing environment-specific values such as API endpoints, Azure AI Search resources, and feature flags in reusable variables, organizations reduce deployment errors and improve maintainability. Environment variables work alongside connection references, which manage authentication, while Azure Key Vault should be used for sensitive secrets.


Practice Exam Questions

Question 1

A Copilot Studio agent calls a REST API whose base URL is different in development, testing, and production. What is the recommended approach?

A. Create an environment variable for the API URL.

B. Hardcode all three URLs in the agent.

C. Create three separate agents.

D. Create separate topics for each environment.

Answer: A

Explanation: Environment variables allow configuration values such as API endpoints to vary by environment without modifying the agent.


Question 2

Which type of information is best stored in an environment variable?

A. OAuth access tokens

B. API base URLs

C. User conversation history

D. Dataverse records

Answer: B

Explanation: Environment variables are intended for configuration settings such as URLs, service names, and feature flags rather than runtime data or authentication tokens.


Question 3

What is the primary benefit of using environment variables?

A. They improve AI response quality.

B. They reduce token consumption.

C. They separate configuration values from application logic.

D. They automatically secure REST APIs.

Answer: C

Explanation: Separating configuration from application logic simplifies deployments and reduces maintenance.


Question 4

Which feature should be used to securely store sensitive information such as API secrets?

A. Text environment variables

B. Adaptive Cards

C. Power Automate variables

D. Azure Key Vault

Answer: D

Explanation: Azure Key Vault is the recommended service for securely storing secrets and can be integrated with Power Platform.


Question 5

What is the relationship between environment variables and solutions?

A. Environment variables cannot be included in solutions.

B. Environment variables are solution components and move with the solution.

C. Environment variables are created automatically during import.

D. Environment variables are only available in managed solutions.

Answer: B

Explanation: Environment variables are packaged within solutions and participate in ALM and deployment.


Question 6

Which statement correctly distinguishes environment variables from connection references?

A. Both store authentication credentials.

B. Environment variables store user conversations.

C. Environment variables store configuration values, while connection references store authentication information.

D. Connection references replace environment variables.

Answer: C

Explanation: Environment variables define configuration values, whereas connection references identify and manage authenticated connections.


Question 7

A developer hardcodes an Azure AI Search endpoint into an agent. What is the primary disadvantage?

A. The agent cannot use generative answers.

B. The endpoint must be manually updated when deploying to another environment.

C. The agent cannot be added to a solution.

D. The endpoint becomes encrypted automatically.

Answer: B

Explanation: Hardcoded values make deployments more difficult because they require manual changes for each environment.


Question 8

Which naming convention is considered a best practice for environment variables?

A. Variable1

B. Test123

C. Value

D. OrdersAPIBaseURL

Answer: D

Explanation: Descriptive names improve readability, maintenance, and long-term governance.


Question 9

When importing a managed solution into production, what typically happens with environment variables?

A. They are deleted automatically.

B. They cannot be modified.

C. Administrators provide production-specific values.

D. They are converted into connection references.

Answer: C

Explanation: During import, administrators typically assign values appropriate for the target environment.


Question 10

Which scenario is the best use case for an environment variable?

A. Storing the current user’s conversation transcript

B. Storing an Azure AI Search service name used by an agent

C. Storing Dataverse table records

D. Storing Power Automate execution history

Answer: B

Explanation: Azure AI Search service names are environment-specific configuration settings that are ideal candidates for environment variables.


Go to the AB-620 Exam Prep Hub main page

Add Existing Agents to a Solution (AB-620 Exam Prep)

This post is a part of the AB-620: Designing and Building Integrated AI Agent Solutions in Copilot Studio Exam Prep Hub.
This topic falls under these sections:
Test and manage agents (20–25%)
   --> Implement application lifecycle management (ALM) for agents in Copilot Studio
      --> Add Existing Agents to a Solution (in Microsoft Copilot Studio)


Note that there are 10 practice questions (with answers) at the end of each section to help you solidify your knowledge of the material. Also, there are 4 practice tests with 30 questions each available from the hub's main page below the exam topics section.

Introduction

One of the core principles of Application Lifecycle Management (ALM) in Microsoft Power Platform is organizing application components into solutions. While it is considered a best practice to create new Copilot Studio agents directly inside a solution, organizations frequently have existing agents that were developed outside of a solution or in another unmanaged solution.

Microsoft Copilot Studio allows these existing agents to be added to a solution so they can participate in a standardized ALM process, including source control, deployment, versioning, and environment migration.

For the AB-620 exam, you should understand:

  • Why existing agents should be added to solutions
  • When to add an existing agent versus creating a new one
  • Solution-aware components
  • Dependencies
  • Required supporting assets
  • Connection references
  • Environment variables
  • Exporting and deploying solution-contained agents
  • ALM best practices

Why Add an Existing Agent to a Solution?

An agent that exists outside a solution is difficult to manage across multiple environments.

Problems include:

  • Manual deployments
  • Missing dependencies
  • Difficult version control
  • No centralized ALM
  • Increased deployment risk
  • Inconsistent configuration

Adding the agent to a solution enables:

  • Repeatable deployments
  • Version management
  • Easier collaboration
  • Automated dependency tracking
  • Better governance
  • Integration with Power Platform Pipelines
  • Source control support

Common Scenarios

Organizations commonly add existing agents when:

  • A proof-of-concept becomes a production application.
  • A personal agent is adopted by a development team.
  • Legacy agents require ALM.
  • Existing agents must be deployed to multiple environments.
  • Multiple developers begin collaborating.
  • Enterprise governance policies require solutions.

Existing Agent vs. New Agent

ScenarioRecommended Approach
Building a new applicationCreate the agent inside a solution
Migrating an existing agentAdd the existing agent to a solution
Preparing for deploymentAdd the agent to a solution
Team developmentUse solutions
Production ALMUse solutions

Whenever possible, Microsoft recommends creating new components directly inside a solution. Existing agents should be added only when they already exist outside a solution.


Prerequisites

Before adding an agent to a solution, ensure:

  • The agent already exists.
  • You have sufficient permissions.
  • The destination solution is unmanaged.
  • Required dependencies are available.
  • Necessary Power Platform licenses are assigned.

Understanding Solution-Aware Components

When an agent is added to a solution, it becomes part of a deployable application package.

However, the solution may also include many related assets, such as:

  • Topics
  • AI instructions
  • Knowledge sources
  • Variables
  • Prompt libraries
  • Power Automate flows
  • Dataverse tables
  • Custom connectors
  • REST API tools
  • Azure AI integrations
  • Security roles
  • Environment variables
  • Connection references

The goal is to package everything required for the agent to function correctly.


Steps to Add an Existing Agent to a Solution

The general workflow is:

  1. Open the Power Apps Maker Portal.
  2. Select Solutions.
  3. Open an existing unmanaged solution.
  4. Select Add existing.
  5. Choose Agent (Copilot Studio).
  6. Select the desired agent.
  7. Confirm the addition.

The agent now becomes part of the solution.


What Happens After the Agent Is Added?

The solution begins tracking:

  • Agent configuration
  • Topics
  • Instructions
  • Metadata
  • Dependencies
  • Related components

This allows the solution to be exported later for deployment.


Dependencies

Agents rarely operate independently.

An agent may rely on:

  • Power Automate flows
  • Dataverse tables
  • Custom connectors
  • REST APIs
  • Azure AI Search
  • Prompt libraries
  • Knowledge sources
  • Environment variables

These assets should also be included in the solution.


Automatic Dependency Detection

Power Platform automatically identifies many required dependencies.

For example:

Agent

Topic

Flow

Custom Connector

Dataverse Table

When exporting the solution, Power Platform alerts administrators if required dependencies are missing.


Adding Missing Components

Sometimes an agent is added successfully, but related assets are not yet included.

Administrators can add:

  • Existing flows
  • Existing connectors
  • Existing tables
  • Existing prompts
  • Existing security roles
  • Existing environment variables

This creates a complete deployment package.


Connection References

Connection references separate authentication details from solution components.

Instead of embedding connections directly into an agent, the solution stores a reusable reference.

Benefits include:

  • Easier deployment
  • Improved security
  • Reduced maintenance
  • Environment independence

Example:

Development:

SQL Server Dev

Production:

SQL Server Prod

Only the connection reference changes.


Environment Variables

Agents often depend on values that differ between environments.

Examples include:

  • API URLs
  • Azure endpoints
  • Storage accounts
  • Feature flags
  • Search indexes

Rather than modifying the agent, administrators update the environment variable after deployment.


Exporting the Solution

After the agent and its dependencies have been added:

  1. Validate dependencies.
  2. Review connection references.
  3. Review environment variables.
  4. Export the solution.

Administrators choose either:

  • Managed
  • Unmanaged

Production deployments typically use managed solutions.


Importing into Another Environment

The destination administrator:

  1. Opens Solutions.
  2. Imports the package.
  3. Maps connection references.
  4. Configures environment variables.
  5. Completes the installation.

The agent is then available in the new environment.


Version Management

Once the agent is part of a solution, versioning becomes much easier.

Example versions:

1.0.0.0

1.1.0.0

1.2.0.0

2.0.0.0

Administrators can track:

  • New features
  • Bug fixes
  • Production releases
  • Rollbacks
  • Upgrades

Working with Source Control

Solutions integrate well with source control systems.

Typical workflow:

Developer

Solution

Source Control

Pipeline

Test

Production

This enables:

  • Team collaboration
  • Code reviews
  • Version history
  • Automated deployments

Common Mistakes

Forgetting Dependencies

An agent may import successfully while required flows or connectors are missing.

Always verify dependencies.


Using Unmanaged Solutions in Production

Production environments should generally receive managed solutions.


Missing Connection References

Hardcoded connections make deployments difficult.

Always use connection references.


Missing Environment Variables

Hardcoded endpoints reduce portability.

Environment variables simplify deployments.


Creating Duplicate Agents

Avoid creating a second copy of an existing agent.

Instead, add the existing agent to a solution and manage it through ALM.


Best Practices

Microsoft recommends:

  • Create new agents inside solutions whenever possible.
  • Add existing agents to unmanaged solutions before beginning ALM.
  • Include all dependencies.
  • Validate solution health before export.
  • Use managed solutions for production.
  • Use environment variables.
  • Use connection references.
  • Use meaningful version numbers.
  • Test solution imports in a non-production environment first.
  • Keep related components together within the same solution.

Exam Tips

Know the difference between:

ConceptPurpose
Existing AgentAlready created outside a solution
New AgentCreated directly within a solution
Managed SolutionProduction deployment
Unmanaged SolutionDevelopment
DependencyRequired supporting component
Connection ReferenceStores authentication and connection information
Environment VariableStores environment-specific configuration

Remember:

Adding an existing agent does not automatically include every related component. You should review the solution to ensure all required dependencies, connection references, environment variables, flows, connectors, and knowledge sources are included before deployment.


Summary

Adding an existing Copilot Studio agent to a solution is a key ALM practice that enables enterprise-grade deployment, governance, and lifecycle management. Once added to an unmanaged solution, the agent can be versioned, packaged with its dependencies, deployed through Power Platform Pipelines, and promoted across development, test, and production environments. Proper use of connection references, environment variables, dependency management, and managed solutions ensures reliable deployments while minimizing configuration errors.


Practice Exam Questions

Question 1

A development team created a Copilot Studio agent outside of a solution several months ago. The team now wants to deploy it through Power Platform Pipelines. What should they do first?

A. Add the existing agent to an unmanaged solution.

B. Recreate the agent in a managed solution.

C. Export the agent directly from Copilot Studio.

D. Convert the agent into a Dataverse table.

Answer: A

Explanation: Existing agents should be added to an unmanaged solution before participating in an ALM process.


Question 2

Which solution type should generally contain an existing agent during active development?

A. Archived solution

B. Managed solution

C. Temporary solution

D. Unmanaged solution

Answer: D

Explanation: Developers work in unmanaged solutions because they remain editable throughout development.


Question 3

Why is it important to review dependencies after adding an existing agent to a solution?

A. To improve AI model accuracy.

B. To ensure all required supporting components are included for deployment.

C. To reduce licensing requirements.

D. To encrypt Dataverse tables.

Answer: B

Explanation: Missing dependencies such as flows or connectors can prevent the agent from functioning correctly after deployment.


Question 4

Which component allows an imported solution to connect to different databases in development and production?

A. Prompt library

B. Knowledge source

C. Connection reference

D. Adaptive Card

Answer: C

Explanation: Connection references separate authentication details from solution components, making deployments portable across environments.


Question 5

What is the primary purpose of environment variables in a solution?

A. Store AI conversation history.

B. Store configuration values that vary between environments.

C. Increase token limits.

D. Encrypt Power Automate flows.

Answer: B

Explanation: Environment variables allow configuration settings such as API endpoints or search indexes to change without modifying the solution.


Question 6

After adding an existing agent to a solution, what should typically be exported for deployment to production?

A. The unmanaged solution

B. Individual agent files

C. The managed solution

D. The Copilot Studio project folder

Answer: C

Explanation: Production environments should receive managed solutions because they provide controlled deployment and protect solution components.


Question 7

Which statement is true about adding an existing agent to a solution?

A. It automatically converts all unmanaged solutions into managed solutions.

B. It automatically creates a new Dataverse environment.

C. It automatically duplicates the agent into every environment.

D. It allows the agent to participate in ALM processes such as versioning and deployment.

Answer: D

Explanation: Adding the agent to a solution enables version control, deployment, and lifecycle management.


Question 8

A developer adds an existing agent to a solution but forgets to include a custom connector used by one of its tools. What is the most likely outcome?

A. The connector is automatically recreated during import.

B. The agent may fail to function correctly after deployment.

C. The connector becomes embedded inside the agent.

D. The deployment automatically creates a replacement connector.

Answer: B

Explanation: Required dependencies should be included in the solution to ensure the deployed agent functions correctly.


Question 9

What is Microsoft’s recommended approach when creating a brand-new Copilot Studio agent?

A. Create it directly inside a solution.

B. Always create it outside a solution first.

C. Create it as a managed solution component.

D. Create it only after deployment.

Answer: A

Explanation: Creating new components directly within a solution simplifies dependency management and ALM from the beginning.


Question 10

Which statement best describes the benefit of adding an existing agent to a solution?

A. It permanently locks the agent against modification.

B. It removes the need for testing.

C. It packages the agent and related components for consistent deployment across environments.

D. It converts the agent into an Azure AI Search index.

Answer: C

Explanation: Solutions provide a consistent deployment package that supports versioning, dependency tracking, and reliable ALM across multiple environments.


Go to the AB-620 Exam Prep Hub main page