Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Updating environment variables via devops pipeline

In reference to Updating Environment Variables in Managed Solution in which @EricRegnier posts a solution to change environment variables during deployment through a devops pipeline. 
He posts the following shell script:

function Update-EnvVariable (
    [Guid] $EnvVariableId,
    [Microsoft.Xrm.Tooling.Connector.CrmServiceClient] $Connection
) {
    $updateFields = @{ }
    $updateFields.Add("value", $Value)  
    Set-CrmRecord -conn $Connection -Fields $updateFields -Id $EnvVariableId -EntityLogicalName "environmentvariablevalue"

However, I am having problems getting the shell script to work. 
I'm getting the following error:

Missing type name after '['.
I've replaced the GUID with the id of my environment variable and "value" with the new environment variable value.

I suppose I'm missing some important detail, but could anyone point me in the right direction?

Helpful resources

PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!


Are Your Ready?

Test your skills now with the Cloud Skill Challenge.


Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

Top Solution Authors
Users online (62,559)