Search code examples
azuregithubgithub-enterprise

Authorize GitHub Enterprise deployment process in Azure App service


In my current company we use GitHub Enterprise as revision control. Where I sign in with SAML to access my account. Now I want to deploy code that is there in GitHub to my Azure App service. So in azure deployment options, I selected GitHub option. But it is saying "Azure needs your permission to access your GitHub account" and asking me to login into GitHub. But I do not have GitHub user name and password as we are using SAML to access GitHub account. Could you please help me how can I authorize GitHub account with Azure?

Azure GitHub deployment process


Solution

  • The Azure deployment process is kinda tricky, trying to deploy from Github Enterprise, I manage to get it working like this:

    1. In the Azure project menu, click on Properties then for the DEPLOYMENT TRIGGER URL, copy it.

    2. Go to the project settings in Github Enterprise, on the option Hooks & Services and add a new webhook, set the DEPLOYMENT TRIGGER URL on the Payload URL, leave everything else the same.

    3. Now we add the deployment process, in the Azure project menu click on Deployment Options then choose as source External Repository

    4. On your Github Account go to settings, then on the menu click on Personal Access Tokens, now generate a new token and give it the following scopes: repo and admin:pre_receive_hook then copy the token

    5. Finally, set the main branch that will activate the webhook when you push code on the repo, on the repository URL we have to set the following items:

    https://<github_access_token>:x-oauth-basic@github.<enterprise>.net/<repo_name_from_root>
    

    something like this:

    https://c4207e6aae44ce086595c9abfcccb5123caf20cc:x-oauth-basic@github.mycompany.net/repolocation/deployrepo
    

    Now push on your repo and the webhook will automatically trigger the deployment and build process.