Edit

Connect to GitHub (preview)

[This article is prerelease documentation and is subject to change.]

To connect a Dataverse environment or solution to GitHub, create a GitHub app, store the app private key in Azure Key Vault, create a Power Platform GitHub connection, and then connect from the source control experience in your solution.

You can access solutions from Power Apps, Power Automate, Power Pages, and Copilot Studio.

Important

  • This is a preview feature.
  • Preview features aren't meant for production use and may have restricted functionality. These features are available before an official release so that customers can get early access and provide feedback.

Prerequisites

  • Dataverse Git integration is a feature of managed environments. Development and target environments must be enabled as managed environments.
  • A GitHub account with organization admin access.
  • An Azure subscription with permission to create Key Vault resources. The Key Vault must be in the same Microsoft Entra tenant as the Dataverse environment.
  • You need a Dataverse environment where you have the System Administrator security role.
  • A custom unmanaged solution that you want to connect to source control. Create one if you don't have one yet.

Create a GitHub app

  1. Open GitHub in your browser. Select your profile picture in the upper-right corner, and then go to Settings > Developer settings.

  2. Select New GitHub App.

    You can also go directly to the GitHub app registration page to create a new GitHub App.

  3. On the Create GitHub App page, enter a unique name for your GitHub app in the GitHub App name field. For example, enter MyOrgGitHubIntegrationApp.

  4. Fill in the Homepage URL field. You can use your organization's website or the GitHub repository URL.

  5. If you don't need webhook notifications, clear the Active checkbox in the Webhook section.

    Screenshot of the GitHub create app page with the GitHub app name field.

Configure repository permissions

  1. Scroll down to the Permissions section.

  2. Expand Repository permissions, and then set Contents to Read and write. This permission allows the app to read and write repository content for source control integration.

    Screenshot of repository permissions for a GitHub app.

  3. Scroll down and select Create GitHub App.

  4. On the GitHub App settings page, copy the Client ID. You need this value when you register the app configuration in Dataverse. The Client ID uses a format such as Iv23liBWoH6sf7xGrRe9.

  5. Generate and download a private key from the GitHub app settings page. Store the private key in Azure Key Vault in a later step.

    Screenshot of the GitHub app settings page with the generate private key option.

Install the GitHub App on the target repository

  1. From the GitHub app settings page, select Install App in the left pane.

  2. Select Install next to the account or organization that owns the target repository.

    If the target repository belongs to a GitHub organization, the organization administrator might need to approve the app installation. The admin receives a notification to review and approve the request.

    Screenshot of the GitHub app installation page.

  3. Choose whether to give the app access to All repositories or Only select repositories. For security best practices, select only the specific repositories needed for source control integration.

  4. Select Install to complete the installation.

    Screenshot of selecting repositories for GitHub app access.

Configure Azure Key Vault

  1. Open the Azure portal and go to your key vault resource. If you don't have one, create a new key vault first.

  2. In the Key Vault pane, select Keys in the left navigation.

    Screenshot of the Azure Key Vault keys navigation item.

  3. Select Generate/Import.

  4. In the Options dropdown, select Import.

  5. Enter a name for the key, such as demoGitHubKey, and then upload the .pem file you downloaded from GitHub.

  6. Select Create to import the key.

    Screenshot of importing a key into Azure Key Vault.

Create a GitHub connection

Create an OAuth connection by using your personal GitHub account. This connection verifies that you have admin access to the target repository during setup. At runtime, the GitHub app handles communication with GitHub, so individual users don't need to create GitHub connections.

Note

You can't use GitHub connections when you enable virtual network (VNET) support for the Dataverse environment. Use a GitHub personal access token (PAT) instead.

  1. Go to the Power Apps maker portal, and then select Connections.

  2. Select New connection.

  3. Search for and select the GitHub standard connector.

    Screenshot of creating a new GitHub connection in Power Apps.

  4. Sign in by using your GitHub account and grant the requested access.

    Screenshot of the GitHub sign-in prompt for a Power Apps connection.

The GitHub account you sign in with must have admin access to the target repository. The OAuth connection verifies your permissions.

After you create the connection, open it. Note the connection ID from the URL in your browser address bar. You need this value when you configure the Git connection.

The connection ID appears in the URL when you view the connection details, as shown in the following example:

https://make.powerapps.com/.../connections/shared_github/{connectionId}/details

Screenshot of a Power Apps GitHub connection details page showing the connection ID in the URL.

Approve OAuth app access for your organization

If your GitHub organization has non-Microsoft application access restrictions enabled, an organization administrator must approve the OAuth app used by the Power Apps GitHub connector. Check your organization's settings at Organization Settings > Third-party access.

Screenshot of GitHub organization third-party application access settings.

For more information, see Enabling OAuth app access restrictions and Approving OAuth apps for your organization.

Connect to GitHub from a solution

  1. Create a new unmanaged solution or select an existing custom unmanaged solution.

  2. On the Source control page, select Connect.

  3. In the Connect to Git pane, select GitHub.

    Screenshot of the Connect to Git pane with Azure DevOps and GitHub provider options.

  4. Enter the GitHub organization, repository, branch, Git folder, and connection information from the previous setup steps.

    Screenshot of GitHub connection details in the Connect to Git pane.

  5. Create a GitHub app configuration and enter the GitHub app client ID, Key Vault URI, and key name from the previous setup steps.

    Screenshot of GitHub App configuration details in the Connect to Git pane.

Configure Key Vault role-based access control (RBAC)

  1. In the Azure portal, go to your Key Vault resource.

  2. Select Access control (IAM), select Add, and then select Add role assignment.

  3. Search for and select the Key Vault Crypto User role.

    Screenshot of selecting the Key Vault Crypto User role in Azure role assignment.

  4. Select Select members, and then search for the Dataverse managed identity associated with your GitHub app configuration. The managed identity name uses the following format:

    PPMI-githubappconfigmanagedidentity-{GUID}
    
  5. Select the managed identity, and then select Review + assign.

    Screenshot of selecting the Dataverse managed identity for a Key Vault role assignment.

If the managed identity doesn't appear, go to the Dataverse environment Settings > System Jobs and check for errors related to GitHub app configuration creation. The registration is created asynchronously and might take a moment to appear.

After the role assignment is complete, the Dataverse managed identity has permission to use the GitHub key in this Key Vault.

Verify the connection and test a commit

Open an unmanaged solution from the Solutions area. If you don't have one yet, create a new solution first. Source control integration only works with unmanaged solutions.

Go to the Source control page and select Git connection. Verify that the connection shows GitHub as the provider and that the organization, repository, branch, and folder details are correct.

To verify the end-to-end flow, select Commit to push your solution to the connected GitHub repository.

If the commit succeeds, the integration is operational.

Connect by using code

You can use the Dataverse Web API or PowerShell to connect to GitHub programmatically instead of using the user interface. For more information, see Connect to a GitHub repository.