WaelHamze / xrm-ci-framework

xRM CI Framework provides you with the tools automate the build and deployment of your CRM Solution. Using the framework to implement a fully automated DevOps pipeline will allow you to deploy more frequently with added consistency and quality.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Do you know how programmatically import solution with passing connection references ?

malaker opened this issue · comments

Hi
I cannot find in current xrm-ci-framework way of configuring connection references within import request. Do you know guys how to do this ?

maybe...

When you have in solution connection references then during import the solution in other environment in new UI during importing user is asked for providing new connections. I am wondering if those connections can be provided somehow programmatically

I don't think this is supported yet, we've been asking MS for a while now on this and keep getting "its not ready yet" - hoping that the functionality will be available in the next couple of months. I had a conversation with someone on Twitter who pointed me at their import powershell script that was used to remap connection references. This might help you out.

https://gist.github.com/devkeydet/f31554566b2e53ddd8e7e1db4af555a6

this relies on you having the connections set up in the target environment but it should help reduce your effort.

maybe...

When you have in solution connection references then during import the solution in other environment in new UI during importing user is asked for providing new connections. I am wondering if those connections can be provided somehow programmatically

Thanks ! I will check that

I found this blog post earlier which basically explains in plain English how to manually perform the steps performed by the PowerShell script referenced above by @don-matese.

Does anyone know where Power Automate Connections are stored? Are they held within an entity in Dataverse that is accessible either via the user interface or the API/SDK?

That PowerShell script actually shows updating the entity. It is in CDS and the schema name is connectionreference. It is a newer entity and I have yet to play with updating it myself yet. I had gone the path previously of modifying the underlying YAML which got ugly really quickly.

@mattp65 I know the records to update are in the connectionreference entity. I was referring to the entity from which we can identify the connection id to use. The PowerShell script is expecting this value to be passed in. I was hoping I would be able to retrieve this dynamically from the environment at runtime?

Sorry, misunderstood. The setup they have is really goofy. I haven't been able to find a good way to track this through to find the GUID at run time. Best I have come up with is to setup a dummy flow that uses each connection type and make sure that is configured properly in the target env and then use that to figure out the GUIDs. Where it gets tough is that the connections, when stored, are user specific. So there can be multiple connections for the same system and no easy way to determine which one to choose.

You can use the PowerApps Powershell module to find the connections. It has a 'Get-PowerAppConnection' function to get the connections.

This returns all connections to all environments you have access to. You can filter it by adding the '-EnvironmentName' parameter. This environment is GUID, you can find these with the 'Get-PowerAppEnvironment' function. Problem is that there is no direct connection between the powerapp and CDS organization. The only connection is the display name. It works but I'm not really happy with using a display name. At least it is unique, as it will put the uniquename between brackets if it's different from the uniquename.

When you figure out the environment, next you need to do is get the correct connection from all of the different connections. This can be easy, but also impossible. The connector has a name (for CDS it's 'shared_commondataserviceforapps'). This can be matched with the connectorid attribute of the connection reference. This works, unless you have multiple connections of the same type. Then I don't know any way to select the correct connection.

All in all I think the most effective and cost efficient way is to simply create a simple json file where you specify the connection references and the connectionids per environment. The connectionid is in the URL when you open a connection. You will need to create the connections manually anyway, might aswell dump the connectionid in a JSON and be done with it.

Thanks for the insight @mVermaat. I'll give it a try :)

@WaelHamze I noticed this interesting commit with the some Connection Reference management code in it :) a6c12b8

Does this mean a pipeline task is in the making/available?