How to Change Solution Owner in the Power Platform
Tags: powerapps, powerautomate, powerplatform, alm
Published: 2023-05-03 08:27:57

Solutions are the back bone to alm in power apps and power automate. Creating a package containing all your components, add in they are the only way to have connection references and environment variables, without them there is no alm.
Unfortunately they were an after thought, rather then by design, which means they are not as polished as they could be, although every update they do seem to improve.

The big issue I found was how to change the owner of a solution, there is no simple way to do it. If you have used the Power Platform you will realise this is a pattern, as changing the owner of anything use to be a challenge. This has started to change, Power Automate flows can now easily be changed (solution aware that is) and Canvas Apps through a connector, but what about solutions. Well it turns out no one owns a solution, think of it more as bag of components rather then a collection, as it just holds them rather then combines them. 
So what does that mean, well we have to change each component of the solution individually. Now Apps and Flows are easy, but what about everything else, well there we need to get a little creative and leverage the underlining database used, ie. Dataverse.

In this guide I will cover the main types, but you will see a pattern emerge pretty quickly, so covering things like security roles etc will be very similar.

1. Cloud Flows
2. Canvas Apps
3. Environment Variables
4. Connection References
5. Custom Connectors

## 1. Cloud Flows
The easiest one by far (thankfully as if not a solution aware it is a lot more complex). First you need to share ownership with the new owner. Then click details, where you can see flow owner, change to the new owner. Finally remove previous owner from shared with.

![Flow change Owner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vvtrjtttrh1sn2afpfp5.png)


_**Note with all these changes we do not change the connections, as this requires the new owner to sign in**_

## 2. Canvas Apps
Not quite as simple, but we can with the help of a flow. We use Set App Owner connector.

![Flow change app owner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/949o96qi828sajiwxbhi.png)

We need to pass in 3 key inputs:

- Environment ID (found in url or session details)
- App ID: (found in app details section)
- AAD ID: (tricky one found in Azure Portal under Active Directory Users)

The set inputs should be:

- API version: 2016-11-01
- Content Type: application/json
- Role For Old App Owner: CanView

And thats it. More info can be found here [MSlearn-set-app-owner](https://learn.microsoft.com/en-gb/connectors/powerappsforadmins/#set-app-owner)

## 3. Environment Variables
Now we are leaving easy and moving to a little more challenging. As I said solutions and components leverage dataverse, so our environment variables are just a dataverse table. But because it's a system table we can't edit it in the PowerApp table view, we have to go back in time. The Power Platform is built on dynamics, and therefor to edit the system tables we sometimes have to go to the dynamics (legacy) settings. These can only be found in make.powerapps.com, not make.powerautomate.com. 

![advanced settings](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n1zejzr7gtpugqr473uu.png)

This has taken us to the dynamic's environment, and we need to find and edit out environment variables definitions table (not the values table).

![Dynamics query](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fwnf7fppzrdhjj8vtacd.png)

First we click on the filter icon to open the query popup. The query editor is quite powerful so we can build a query with multiple conditions. But in these examples we are going to presume there isn't many environment variables so we can view all.

![environment variable table](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g439d7hdescffm4me1kf.png)

We need to select the environment variables definitions table, then click results. You should see a list of all variables, find the one you need and click it.

![Dynamics filter results](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/odd9alj3fam114vuz91q.png)

As you can see it has opened a model driven app record screen, we just need to change owner to our new owner. And that's it.

![environment variables definition form](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g0ndaquelf2k7vr1hhys.png)

_You can see above the variable type (data) and even the value (even though thats in another table)_

## 4. Connection References

Connection References are similar to Envirnoment Variables, we go to advance settings again, filter but select the Connection Reference table.

![connection reference table](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3w67d733ni7bjqke5e2g.png)

But after selecting a Connection Reference it's now a little different. It's not been updated to the new dataverse form, so it opens the old dynamics form. Apart from the visuals it's almost the same, except insted of updating the Owner field we click on the Assign to select the new owner - yep you can see that this is built on a CRM (Customer Relationship Management) software when we 'assign' ownership.

![connection references form](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3cd8qkdz86bsc1dvfxdv.png)


## 5. Customer Connectors

This is exactly same as Connection References, again we go to our classic Dynamics site and query popup. But again we select a different table, the Connectors table.

![connectors table](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tfos97hkwraemqhrai4d.png)

It's the classic form and we assign.

![custom connector form](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8wi9bkbe4v8okgwrn4wz.png)

---


**Bonus** here we can also share our connection references and custom connectors (as the share button for custom connectors doesn't work in solution aware custom connectors). We just use share instead of assign.

![share custom connector](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mjj5tophy7t8lg0dokew.png)

A popup will now show who you have already shared with and what permissions you have given.

![share custom connector permissions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iqhm10bhdtiibuk3s9ko.png)

Add User/Team opens popup where you can search and add users or security groups.

This also works for connection references. Environment variables are similar, we use share instead of assign/ click on owner.

![environment variable share](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kj64eawu9jqap0egu9bv.png)

Click add and type in who to share with. Select them and click on the name to see same permissions selector but in new modern view.

![environment variable share permissions](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nld8hgpsa7kzjv4kncv0.png)

---

As you can see changing the owner of multiple solution components can be time consuming so let's hope Microsoft simplifies the process. But the sharp eyed may have realised because these are just Dataverse tables we can create a Power Automate flow to do everything automatically (if you want to see how to in a part 2 let me know).

---

As the Power Platform continues to develop it appears more and more will be saved in dataverse aka dynamics, and as shown you can do a lot by going under the hood and updating the record directly in the database.