web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / No environment variabl...
Power Apps
Answered

No environment variable definition found for schema name

(0) ShareShare
ReportReport
Posted on by 19

Greetings.

 

My setup:

I am using the Azure DevOps tools for moving solutions to downstream environments (DEV > QA > PROD).

In DEV we have a solution with

- Power App x2

- Power automate flow x3

- environment variable x6

Also, the flows of this solution consume secret environment variables (from azure KV) that were removed from the DEV solution but are still available in the environment.

 

In my ADO build pipelines I have this YAML content.

 

 

trigger:
 branches:
 include:
 - main
 paths:
 include:
 - salesDepartment


pool:
 vmImage: windows-latest

steps:
 - task: PowerShell@2
 inputs:
 targetType: 'inline'
 script: |
 Get-ChildItem -Recurse -Path $(Build.Repository.LocalPath)

 - task: PowerPlatformToolInstaller@0
 inputs:
 DefaultVersion: true

 - task: PowerPlatformWhoAmi@0
 inputs:
 authenticationType: 'PowerPlatformSPN'
 PowerPlatformSPN: 'DEV-ENV-ServiceConnection'

 - task: PowerShell@2
 inputs:
 targetType: 'inline'
 script: |
 # Write your PowerShell commands here.
 $version=$(Get-Date -Format yyyy.MM.dd.HHmm)
 Write-Host "##vso[task.setvariable variable=version;]$version"

 - task: PowerPlatformSetSolutionVersion@0
 inputs:
 authenticationType: 'PowerPlatformSPN'
 PowerPlatformSPN: 'DEV-ENV-ServiceConnection'
 SolutionName: '$(SolutionName)'
 SolutionVersionNumber: '$(version)'


 - task: PowerPlatformExportSolution@0
 displayName: Export unmanaged solution
 inputs:
 authenticationType: 'PowerPlatformSPN'
 PowerPlatformSPN: 'DEV-ENV-ServiceConnection'
 SolutionName: '$(solutionName)'
 SolutionOutputFile: '$(Build.BinariesDirectory)/$(SolutionName)_unmanaged.zip'
 Managed: false
 AsyncOperation: true
 MaxAsyncWaitTime: '60'


 - task: PowerPlatformUnpackSolution@0
 displayName: Unpack solution
 inputs:
 SolutionInputFile: '$(Build.BinariesDirectory)/$(SolutionName)_unmanaged.zip'
 SolutionTargetFolder: '$(Build.SourcesDirectory)/$(SolutionName)'

 - task: PowerPlatformChecker@0
 inputs:
 PowerPlatformSPN: "DEV-ENV-ServiceConnection"
 FilesToAnalyze: "$(Build.BinariesDirectory)/$(SolutionName)_unmanaged.zip"
 RuleSet: "0ad12346-e108-40b8-a956-9a8f95ea18c9"

 - task: PowerPlatformExportSolution@0
 displayName: Export managed solution
 inputs:
 authenticationType: 'PowerPlatformSPN'
 PowerPlatformSPN: 'DEV-ENV-ServiceConnection'
 SolutionName: '$(SolutionName)'
 SolutionOutputFile: '$(Build.BinariesDirectory)/$(SolutionName)_managed.zip'
 AsyncOperation: true
 Managed: true
 MaxAsyncWaitTime: '60'

 - task: CopyFiles@2
 inputs:
 SourceFolder: '$(Build.Repository.LocalPath)/grns/apm/'
 Contents: '**'
 TargetFolder: '$(Build.BinariesDirectory)/configurationFiles'


 - task: PowerShell@2
 displayName: Create a new branch
 inputs:
 targetType: 'inline'
 script: |
 $solutionName = ${env:SOLUTIONNAME}
 $exportBranchName = "${env:SOLUTIONNAME}-$(Build.BuildId)"
 cd $(Build.SourcesDirectory)
 git config user.email "noreply@dev.azure.com"
 git config user.name "Azure Pipeline"
 git checkout $(Build.SourceBranchName)
 git checkout -b $exportBranchName
 git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" push --set-upstream origin $exportBranchName
 showWarnings: true

 - task: CopyFiles@2
 inputs:
 SourceFolder: '$(Build.BinariesDirectory)'
 Contents: '**'
 TargetFolder: '$(Build.Repository.LocalPath)/exportArtifacts'

 - task: CmdLine@2
 displayName: Commit and Push changes
 inputs:
 script: |
 cd $(Build.SourcesDirectory)
 git add --all
 git commit -m $(SolutionName)-$(Build.BuildId)
 git -c http.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" push

 - task: PublishBuildArtifacts@1
 inputs:
 PathtoPublish: '$(Build.BinariesDirectory)'
 ArtifactName: '$(SolutionName)'
 publishLocation: 'Container'

 

The Build pipeline works as expected, no issues there.

 

In my release pipeline I have:

Screen Shot 2022-07-26 at 12.36.53 PM.pngScreen Shot 2022-07-26 at 12.55.38 PM.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The deployment settings file:

I removed parts that might contain sensitive information

{
 "EnvironmentVariables": [
 {
 "SchemaName": "removed for privacy",
 "Value": "removed for privacy"
 },
 {
 "SchemaName": "removed for privacy",
 "Value": "removed for privacy"
 },
 {
 "SchemaName": "removed for privacy",
 "Value": "removed for privacy"
 },
 {
 "SchemaName": "removed for privacy",
 "Value": "removed for privacy"
 },
 {
 "SchemaName": "psh_user",
 "Value": "/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME/providers/Microsoft.KeyVault/vaults/KEYVAULT_NAME/secrets/SECRET_NAME"
 },
 {
 "SchemaName": "psh_password",
 "Value": "/subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP_NAME/providers/Microsoft.KeyVault/vaults/KEYVAULT_NAME/secrets/SECRET_NAME"
 }
 ],
 "ConnectionReferences": [
 {
 "LogicalName": "apm_JIRAforCloudFlows",
 "ConnectionId": "removed for privacy",
 "ConnectorId": "/providers/Microsoft.PowerApps/apis/shared_jira"
 },
 {
 "LogicalName": "apm_MicrosoftDataverseforCloudFlows",
 "ConnectionId": "removed for privacy",
 "ConnectorId": "/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps"
 },
 {
 "LogicalName": "apm_sharedcommondataserviceforapps_bfaba",
 "ConnectionId": "removed for privacy",
 "ConnectorId": "/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps"
 },
 {
 "LogicalName": "apm_sharedgmail_781b6",
 "ConnectionId": "removed for privacy",
 "ConnectorId": "/providers/Microsoft.PowerApps/apis/shared_gmail"
 }
 ]
}

 

 

The error

When I run the release pipeline to import this solution and deployment settings onto a downstream environment I get this error.

 

Message: An unexpected error occurred.Detail: 
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
 <ActivityId>1bb8bbb6-4f0c-4b6b-8813-de7662431b56</ActivityId>
 <ErrorCode>-2147220970</ErrorCode>
 <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
 <KeyValuePairOfstringanyType>
 <d2p1:key>ApiExceptionSourceKey</d2p1:key>
 <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">Plugin/Microsoft.Dynamics.EnvironmentVariables.Plugins.CreateVariableValue</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>ApiOriginalExceptionKey</d2p1:key>
 <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">Microsoft.Xrm.Sdk.InvalidPluginExecutionException: No environment variable definition found for schema name apm_JiraUsername. ---&gt; Microsoft.Xrm.Sdk.InvalidPluginExecutionException: No environment variable definition found for schema name apm_JiraUsername.
 at Microsoft.Dynamics.EnvironmentVariables.Plugins.CreateVariableValue.Execute(IServiceProvider serviceProvider)
 at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
 at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
 --- End of inner exception stack trace ---
 at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
 at Microsoft.Crm.Extensibility.PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)
 at Microsoft.Crm.Extensibility.Pipeline.&lt;&gt;c__DisplayClass3_0.&lt;RunStep&gt;b__0()</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>ApiStepKey</d2p1:key>
 <d2p1:value xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/" i:type="d4p1:guid">5e068ed2-48ae-e911-819a-000d3af93155</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>ApiDepthKey</d2p1:key>
 <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:int">3</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>ApiActivityIdKey</d2p1:key>
 <d2p1:value xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/" i:type="d4p1:guid">e341987f-4ea7-47df-a770-6154165d8c88</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>ApiPluginSolutionNameKey</d2p1:key>
 <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">EnvironmentVariables</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>ApiStepSolutionNameKey</d2p1:key>
 <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">EnvironmentVariables</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>ApiExceptionCategory</d2p1:key>
 <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">ClientError</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>ApiExceptionMessageName</d2p1:key>
 <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">IsvAborted</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>ApiExceptionHttpStatusCode</d2p1:key>
 <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:int">400</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>OperationStatus</d2p1:key>
 <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:int">0</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>SubErrorCode</d2p1:key>
 <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:int">-2146233088</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>Plugin.PluginTrace</d2p1:key>
 <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">[Microsoft.Dynamics.EnvironmentVariables.Plugins: Microsoft.Dynamics.EnvironmentVariables.Plugins.CreateVariableValue]
[5e068ed2-48ae-e911-819a-000d3af93155: CreateVariableValue]
[CreateVariableValue]: Microsoft.Xrm.Sdk.InvalidPluginExecutionException: No environment variable definition found for schema name psh_user.
 at Microsoft.Dynamics.EnvironmentVariables.Plugins.CreateVariableValue.Execute(IServiceProvider serviceProvider)</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>HasRetried</d2p1:key>
 <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">True</d2p1:value>
 </KeyValuePairOfstringanyType>
 <KeyValuePairOfstringanyType>
 <d2p1:key>RetryExecutionStatus</d2p1:key>
 <d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">Microsoft.Crm.Core.Extensions.Retry.RetryExecutionStatus</d2p1:value>
 </KeyValuePairOfstringanyType>
 </ErrorDetails>
 <HelpLink>http://go.microsoft.com/fwlink/?LinkID=398563&amp;error=Microsoft.Crm.CrmException%3a80040216&amp;client=platform</HelpLink>
 <Message>An unexpected error occurred.</Message>
 <Timestamp>2022-07-26T15:02:57.0620092Z</Timestamp>
 <ExceptionRetriable>false</ExceptionRetriable>
 <ExceptionSource i:nil="true" />
 <InnerFault>

This fragment catches my attention:

No environment variable definition found for schema name psh_user

 

If I remove psh_user and psh_password, the deployment won't fail but I definitely need those secrets available as environment variables.

 

In the Solution in the downstream environment, I see this

Screen Shot 2022-07-26 at 12.50.39 PM.png

 

Has anyone experienced this issue before?

 

Thanks

 

 

I have the same question (0)
  • Verified answer
    FelipeLujan Profile Picture
    19 on at

    I was able to solve this issue. I imported the environment variables into the solution in the source environment with both the current value and the variable definition.

    Then, also in the source environment, I removed the current value from the solution and proceeded to export it.

    Now, the environment variable definitions are part of the solution, and I can import it into the downstream environment.

     

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard