cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Shidin
Frequent Visitor

MS Flow Automated Deployment

Repost from https://community.dynamics.com/crm/f/117/t/321797

 

I have solution-enabled flows in my PowerApps solution.

Solution-enabled flows can be deployed to production instances automatically through a CI/CD process.

Is there any way to automate the deploying the connections used in the flow? 

 

Thanks in advance!

2 ACCEPTED SOLUTIONS

Accepted Solutions
v-yamao-msft
Community Support
Community Support

Hi @Shidin ,

 

Could you share more details on your scenario?

 

Does a CI/CD process mean Continuous Integration/Continuous Deployment of modern DevOps environment?

 

Do you want to deploy the connections from one instance to another?

 

When creating connections, we need to provide account info and credentials, so I am afraid that it might be not possible to deploy the connections automatically.

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

For anyone landing on this, environment variables, to be released as part of October 2019 updates seem to be key ! 

View solution in original post

16 REPLIES 16
v-yamao-msft
Community Support
Community Support

Hi @Shidin ,

 

Could you share more details on your scenario?

 

Does a CI/CD process mean Continuous Integration/Continuous Deployment of modern DevOps environment?

 

Do you want to deploy the connections from one instance to another?

 

When creating connections, we need to provide account info and credentials, so I am afraid that it might be not possible to deploy the connections automatically.

 

Best regards,

Mabel

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

For anyone landing on this, environment variables, to be released as part of October 2019 updates seem to be key ! 

Hi Shidin, so I thought too. But it seems that environment variables cannot be used to configure SharePoint flow triggers. Did you find any workaround ?

Hi All,

 

I have created flows using the solution and the CDS Current environment connectors so that they can be deployed to other instances via CI/CD.  All look good in terms of automatic deployment, but I come across an issue in that after deployment, all the flows are turned off every time it is deployed. 

 

It forces us to manually turn on every time after deployment to SIT.  Do we have an option to automate or should I exclude the flows from the common dynamics solution?  What is the correct way of deploying flows to different instances?

 

Flow deployment.JPG

Madhankumar
Frequent Visitor

Any update on this Issue? Even am facing the same issue, once after deployment, i have to setup connection and turn on the powerautomate. Help pls

Aedu
Helper II
Helper II

We have the same issue, even when the connection already exists in the target environment and all flows were manually turned on after last deployment, all flows are always turned off.

Any suggestions?

MustaqueEhiya
Regular Visitor

Hi @Aedu 

 

Recently from one of our community developers (Sorry I couldnt get that link now), I got a PowerShell Script to use in the Azure Pipelines and I have started using that.

 

You can use the below script to automate that.

 

$Username=''
$Password=''
$EnvironmentName=''

try
{
$modulePowerAppAdministrator=’Microsoft.PowerApps.Administration.PowerShell’
$modulePowerAppAdministrator=’Microsoft.PowerApps.PowerShell’

if(!(Get-Module -ListAvailable -Name $modulePowerAppAdministrator))
{
Write-Host “Installing PowerAppsModule.”
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-PackageProvider -Name NuGet -RequiredVersion 2.8.5.201 -Force
Install-Module -Name Microsoft.PowerApps.Administration.PowerShell -Force -Verbose -Scope CurrentUser
Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber -Force -Verbose -Scope CurrentUser
Write-Host “Installed Successfully PowerAppsModule.”
}
else
{
Write-Host “Module already installed”
}

}
catch
{

Write-host $_.Exception.Message
}

try{
Write-Host “Connecting Target Instance of PowerApps.”
$pass = ConvertTo-SecureString $Password -AsPlainText -Force
Add-PowerAppsAccount -Username $Username -Password $pass
Write-Host “Successfully Target Instance connected.”
}
catch
{
Write-host $_.Exception.Message
}

try{
Write-Host “Connecting Environment.”

$en=”*$EnvironmentName*”
$environmentName = Get-PowerAppEnvironment $en | Select -ExpandProperty EnvironmentName
Write-Host “Connected Environment.” $environmentName

Get-FlowEnvironment $environmentName
}
catch
{
Write-host $_.Exception.Message
}


$listOfMsFlow="";

$listOfMsFlow = Get-AdminFlow -EnvironmentName $environmentName |where-object { !($_.Enabled -eq "True") } | Select FlowName
$count=1;

foreach ($flow in $listOfMsFlow)

{

try
{

Write-Host "Flow Name : " $flow.FlowName $count

Enable-AdminFlow -EnvironmentName $environmentName -FlowName $flow.FlowName

#Disable-AdminFlow -EnvironmentName $environmentName -FlowName $flow.FlowName
# Write-Host “Turn Off.” $flow
$count=$count+1;
}

catch

{
Write-Host "Failed to Turn On " $flow.FlowName
Write-host $_.Exception.Message
}
}

Awesome script. I will try it out.

Thanks a lot!

Did the issue got resolved ?

I am also facing the same issue 

Did you find any thing regarding the issue

 

Mustaque_Ehiya
Helper III
Helper III

With the above powershell script, my issues are resolved and using it in pipelines.  

Aedu
Helper II
Helper II

With the above script the flows can be activated. All important commands are included in the script. This is the value of the script. But you have to keep in mind that the script activates all flows in the environment, even non-solution based flows. But it is not difficult to customize the script.

Sowrabh1
Microsoft
Microsoft

can u please say while deploying in CI/CD pipeline how to reset connections automatically

Aedu
Helper II
Helper II

Hi @Sowrabh1 

As I understand it, you cannot "reset" Connections. Connections are not transferable via Solution, only Connection References.

 

For CI/CD scenarios you can automate the mapping between Connections and Connection References via this link: https://docs.microsoft.com/en-us/power-platform/alm/conn-ref-env-variables-build-tools


But also here you have to create the connection in the new environment manually, find out the Guid of the connection and then add it manually in the configuration file above.

You can also assign a connection to a connection reference with the following PowerShell command, but I didn't use that until now:
# Set the connection on a connection reference:
Set-CrmRecord -conn $conn -EntityLogicalName connectionreference -Id $connectionreferenceid -Fields @{"connectionid" = $connectorid }

 

Maybe an easier solution, if you have only few Connection References to switch to another Connection is to do it manually in the target environment. You can open the Base Solution, find the Connection References and edit them.

Where should I be adding the above script 

Aedu
Helper II
Helper II

Hi @saikrishnavcsge 

 

You can add a powershell task containing above script in a DevOps release pipeline.

I haven't tried it myself yet.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (3,085)