cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SKV
New Member

Deployment-Import Solution with Custom Connector

Does the platform support  to import a solution to the Production environment from development environment which has custom connector - connecting to gateway.

 

Documentation says it doesnt support 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/export-import-app 

 

Is there a workaround to achieve the same by modifying the SOlution xml or connectors xml file in the exported/downloaded zip file.

 

 

7 REPLIES 7
jekakou
Community Support
Community Support

Hello SKV, 

Thank you for your post.  

Unfortunately there is no workaround. any modification on the solution or xml connector is not supported as well. 

 

@SKV 

 

As @jekakou says it is not supported in your exact way you suggest here and also, I have a question for you.

 

Is there specific reason your scenario requires the development and production versions to use the exact same Custom Connector? If you have a dev and prod app, likely you have a dev and prod backend as well is my guess. If you try to connect to exact same backend on exact same Connector, this may be a sign that what you are trying to do is not a good idea in general as it will not separate the concerns of development from production.

 

I recommend you edit your Canvas App so you have a variable to determine if it is in the DEV or PROD state and have both Custom Connectors in there in IF formulas instead - if in DEV, perform the action in the DEV one - if in PROD, use the PROD one instead. Even better if the variable is an environment variable consumed by a Canvas App instead.

 

 

As for the second Custom Connector in the production Dataverse environment (formerly known as a Common Data Service environment), yes you must create it from scratch. However what you can do, is that you can just copy and paste Swagger file from the dev one, to the new Custom Connector in the target environment - and I also recommend you better change it slightly so it points to the other backend (production version of backend)  as well - that would be even better - and this way it will be much better as you have truly separate Development and Production environments in all aspects.  

 

To test the above, you would start by creating the second Custom Connector actually in your current development Dataverse environment. Then you can check if the Canvas App correctly will go through each backend based on the IF formulas. After that, you create environment variable as well. Finally, you would create both Custom Connectors (dev and prod) version on the production environment and make sure the Environment variable on the target environment is set to production, and on development it is set to development.

 

In case you had more than two environments you could continue to adapt this pattern above to making a third connector for staging and change the IF to a SWITCH to switch between three environments. You could even have an environment whose only purpose is to toggle between the three modes and make sure everything is consistent in all versions of your backend, etc. - the possibilities are endless with Power Platform!

 

It is also already possible currently to import the Canvas App from development to production if done this way, so if you perform the above instead, you are likely to have a better result in general.

 

By the way. If you really want to be able to import a Canvas App with the Custom Connector. Actually, I may know a way to do it - if you really want to know I could tell you - but it would have these caveats:

 

1) It does not use solutions for that way - there is no solution to try to "hack"

2) It is really not recommended though in general that way.

3) Finally , it might only work on the same Dataverse environment only (formerly called Common Data Service environment) - maybe this way does not work for the different Dataverse environment - so then maybe it will not work for your specific use case.

 

So instead I recommend editing Canvas App so it could work on both production and development with the variable to determine in which mode it should run in. You also get more benefits like having the app do certain things only on development, etc. which would be more difficult actually to achieve in the functionality you propose if it were able to export and import the custom connector exactly.

 

Check if above works for you. Other than this I would concur with @jekakou on that there would be no specific workaround that fits your exact constraints as you gave them.

 

In case you wanted the exact functionality as you suggested to be supported in that exact way to export and import Custom Connector inside solution, I can only suggest you upvote an existing idea or suggest a new idea in the forums in case you insist that it must be in that specific way.

 

 

frank_e_mueller
Frequent Visitor

The suggestion with the environment variable sounded great, I am wondering how it is done, as the environment variable at the moment just supports Sharepoint Online as a data source, so I am curious how you get it to work with a custom connector.

akandis
Responsive Resident
Responsive Resident

Hello all,

 

Related to the Environment Variable in the Custom Connector is correct appreach and you can achieve it by using OpenApi "syntax".

 

To sum up you will need to create a Query parameter for example called "endpoint" then you will have to create a new Policy in order to take this value of the Query to replace the URL.

 

I will share the video that helped me on that part.

https://www.youtube.com/watch?v=PmfrG57-9Hc

 


@poweractivate wrote:

Is there specific reason your scenario requires the development and production versions to use the exact same Custom Connector?

Absolutely! Have 3rd-party APIs that we use with custom connectors. Makes no sense to create two versions of a custom connector for a 3rd-party API, when it's the same data either way. To introduce as few unknowns as possible, I think you want the exact same code running in both dev and prod for connection to a 3rd-party API (unless that 3rd-party API has a sandbox mode that you want to use).

So yes, in the case of 3rd-party APIs with no sandbox mode, it absolutely makes sense to export the exact same custom connector to another environment.

I was able to get it working by honing down my solution to just the one custom connector which it's currently using (by removing all of my test flows that used other custom connectors from the solution as well as those unneeded custom connectors themselves), and after making sure that custom connector was already imported to the target environment in a solution by itself, I was able to import my entire solution with canvas apps, flows, and that one custom connector reference. I was able to click "+New connection" for the custom connector and select the existing copy of the custom connector in that target environment.

akandis
Responsive Resident
Responsive Resident

Hello all,

 

Related to the Environment Variable in the Custom Connector is correct appreach and you can achieve it by using OpenApi "syntax".

 

To sum up you will need to create a Query parameter for example called "endpoint" then you will have to create a new Policy in order to take this value of the Query to replace the URL.

 

I will share the video that helped me on that part.

https://www.youtube.com/watch?v=PmfrG57-9Hc

 

I have tested that Policy feature and was unable to make my use case work with that method.

I was having a problem where I wanted to customize the Authorization parameter in the header, but Custom Connector disallows that. I'm sure the Policy feature is great for other stuff though.

There is one API that I am unable to make work as a custom connector, and it turns out that the reason is due to Microsoft Custom Connectors sending clientId and secret in body of refresh token request (which is to OAuth2 spec AFAIK) but the 3rd-party API requires refresh token requests to just have the refresh token in the body, no clientId and secret. So for that API I had to use Power Automate HTTP requests to make it work.

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (1,827)