Connecting Azure DevOps pipelines to PowerApps env

In order to be connected to the APSD Power Apps environments through Azure DevOps, an app registration must be created in Azure Portal first. Once that is created, there are then two parts to hooking up DevOps to PowerApps environments: (1) Creating the service connection in DevOps (2) Adding it as an application user in PowerApps. A service connection will be required when we create a pipeline or set up up any other automated task through Azure.

 Part 1. Create a service connection in DevOps

  1. Go to https://dev.azure.com/transport-canada/AFCCC

  2. Click on the Project settings at the left bottom corner.

    Project settings
  3. Click on Service connections

    Service connections
  4. Click on New service connection top right corner

  5. In the search box type, power and select the Power Platform --> click Next

  6. Enter all the required information under the 'New Power Platform service connection as shown in the picture. This information can be found from Azure portal. You will need to have the Server URL, Tenant ID, Application ID and Client secret of Application ID. Please see RDIMS #17999814 for all the information needed for client secret.
    Under the Service connection name provide the name of the application with the environment name.
    Lastly, check the Grant access permission to all pipelines.

 Part 2. Add an application user in PowerApps

  1. Go to the Power app platform for the environment you are setting up, then click on the wheel to the right of it → select Admin center

  2. Click on the environment you are setting the connection for in our example it is the qa

  3. Click on S2S Apps See all (on the right end side under Access)

  4. Set up a new application user

  5. Click on the plus to add an app

  6. In the search box start typing Civil Aviation and it should bring the option to select

  7. Click on the Civil Aviation to add it as an app from Azure Active Directory → then click Add

  8. Under Business unit open the drop down and you should see the sandbox that is associated with the environment you are trying to setup.

  9. Under Security roles click on edit pencil icon → Scroll down and add the System Customizer Role to this app user → Click Save.

  10. You should now be able to create the new app user by clicking create

  11. Test your connection in Azure through the pipeline.

 

If you get an error on the build “[error]Failed to connect to Dataverse”, this means a new app user needs to be added in the Power Apps environment. Follow Part 2 to resolve this error.

 Related articles

https://docs.microsoft.com/en-us/power-platform/alm/devops-build-tools