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.
MIT License
185 stars 116 forks source link

Sample schemas for UpdateConnectionReferences and UpdateEnvironmentVariables #324

Open westerdaled opened 1 year ago

westerdaled commented 1 year ago

Are there any known samples for the above. So far, we have on found this inelegant format to work and not what is shown in the official guidance: prepopulate connection references

[
   [ "name1", value1"], 
   [ "name12", "value2"],
......
]
ciaomatteo commented 1 year ago

@westerdaled : I think, this is what you are looking for. https://github.com/WaelHamze/dyn365-ce-devops-sample/commit/253c566232aa576c2296163a44a76c78839faf50

westerdaled commented 1 year ago

Hi @WaelHamze

Firstly, I apologize for taking so long in replying - I thought I had.

To give you an update we did attempt the JSON format you suggest but we experienced limited success.

Instead, we created a couple of variables

EnvironmentVarJson

[
    ["mysol_EnvironmentName","Development"],
    ["mysol_RootFileSystemPath","\\\\domain.local\\UK\\Groups\\Sales\\London\\DEV"],
    ["mysol_Sales_DB","DBServer\\Ins_1"],
    ["mysol_shared_sharepointonline_683e8d269xxxxxxxxxxx","https://domain.sharepoint.com/sites/keepcalmSales"],

]

ConnectionsRefJson

[
    ["mysol_NetworkFileSystem","<guid>"],
    ["mysol_sharedexcelonlinebusiness_12b58","<guid>"],
    ["mysol_Sharepoint","<guid>"],
    ["mysol_SQLServer","<guid>"]
]

These variables we use to update

.\UpdateConnectionReferences.ps1 -CrmConnectionstring $TestConnection -ConnectionReferencesJson $ConnectionRefJson
 .\UpdateEnvironmentVariables.ps1 -CrmConnectionstring $TestConnection -EnvironmentVariablesJson $EnvironmentVarsJson

Now I would prefer your format and would be happy to retry using it a solution I am currently working with. Also, we haven't been able to automatically deploy the connections needed by a solution. So, we still have to create these manually, whist login in under the service account for the given solution. More than happy to drop that step if you know a way!

h-karthik12 commented 1 year ago

@CrmDev23 @WaelHamze We get error when updating the connection reference in managed solution and unmanaged @westerdaled Did you find any solution

westerdaled commented 1 year ago

We did a couple thing to get successful automated deployments. Firstly, we ensured that all solutions used only their set of connection references, so they could be upgraded and uninstalled independently. Then you have the pre-steps as outlined above using the format for both environment vars and connection references. Finally, ensure your system account used for deployment has the System Admin security role. MS is promoting the alternative PowerPlatform Pipelines. It may suit you if you have a budget for per app or per user premium accounts as these allow access to managed environments.