Azure Github Integration with custom domain - github

I want to use github to deploy my webapp on Azure. I setup github on Azure as my deployment source. But since I have a custom domain instead of using the free azurewebsits.net, I think I am having issues seeing the website from github. The webhook on github shows azurewebsites.net.... same on azure. I can edit the webhook on github but can't on Azure. What is the best way to integrate github with azure with a custom domain?

You don't need to edit the webhook on github, let it stick with the default sitename.azurewebsites.net.
When you setup a custom domain name, your default domain name (sitename.azurewebsites.net) still keeps working. Github will use that to deploy to your site

Related

I want to convert my Github account into a organisation without affecting my action runners

We have 7 repos in our Github account and they are currently deployed using Github actions. I wanna confirm if we can convert the account into an organisation and this won't affect my services and website running right now via Github action runners.

GitHub Could not create service hooks subscription Unable to configure a service on the selected GitHub... Resource not accessible by integration

When I try to update the environment variables on an Azure DevOps release pipeline, I get the error below.
GitHub Could not create service hooks subscription Unable to configure a service on the selected GitHub repository. GitHub returned the error 'Resource not accessible by integration'.
I am an admin on the GitHub repo.
In Get sources, it is currently configured for a GitHub OAuth Service Connection. Another user is able to update the environment variables. I am using GitHub (not enterprise).
Is this an Azure DevOps permission that I do not have?
Is this an Azure DevOps permission that I do not have?
This error message usually comes with GitHub App installation token service connection.
Go Project Settings => Service Connections to check the details of the specific service connection. If your service connection is GitHub App installation token based service connection, then it's expected behavior to meet that issue. Our team are working on adding that support so far, please check this ticket.
Workaround:
1.Create a new service connection with OAuth/PAT method and use it in your pipeline. Since you're admin of the github repo, a Github PAT is more recommended.
2.If you have permission to the service connections and to the pipeline, this issue won't occur. Ask your Azure Devops project admin to via manage security.
After working with ADO tech support, it was discovered that we needed to remove the artifact and trigger definition from the release pipeline, and then re-add it. It is believed that there was cached service connection, and this updated the pointer to the correct service connection.
I was facing a similar issue when attempting to enable CI for a build and found this article and after digging in deeper I discovered that the issue was the actual PAT we created for the automation. What we missed originally was enabling the admin:repo_hook for the repository. This took longer to uncover than it should have, but just wanted to add that, as removing and re-adding things didn't really do anything for us.

Connect Azure Pipelines to GitHub Enterprise

We have a hosted GitHub Enterprise (GHE) account which needs to integrate with Azure Pipelines. I have installed the Azure Pipelines app from the GitHub Marketplace for our GHE account. The installation of the Azure Pipelines app asks to select an Azure DevOps project and GHE repo to setup the integration. This results in one pipeline being connected to a GHE repo.
But my question is, how to we setup other pipelines within Azure DevOps to use repos in GHE?
Nowhere in the Azure Pipelines interface can I find an option to select a GHE repo. Only public GitHub and GitHub Enterprise (on-prem) server repos. It seems that only the Azure Pipelines app setup wizard allows you to configure a pipeline with a GHE.
I can't imagine that we would have to initiate the setup wizard of the Azure Pipelines app every time we want to connect a pipeline to a GHE repo. That wouldn't even be possible, because most coworkers won't have the permissions to do that. What am I missing?
Remark: I realize that we could create a service connection in Azure DevOps using on a Personal Access Token or username+password. But that's tied to someone's personal account. If that person would leave, the connection is broken. Unless you create a service/dummy account, which doesn't seem very elegant.
If you use GitHub Enterprise, then you can integrate with Azure AD. Then based on group membership you can assign access to repositories with the help of Github Teams.
Then based on those permissions the repos to which somebody has access will be visible during the setup of the Azure DevOps pipeline.
Some useful resources:
https://learn.microsoft.com/en-us/azure/active-directory/saas-apps/github-tutorial
https://github.blog/2019-09-24-azure-active-directory-team-synchronization-now-available-with-enterprise-cloud/
https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/about-teams
https://enterprise.github.com/support
I found out the cause of the issue.
First of all, when you install the Azure Pipelines app from the GitHub marketplace, you first need to make sure that you select your GitHub organisation and not your personal account.
Secondly, during the installation you are taken to Azure DevOps to setup your project. Two different authorization pages will be shown; "Azure Pipelines by Microsoft would like to [...]" and the page for OAuth authorization. As can be seen in below image, there is a small grant button that's easily overlooked. You need to press that button before you press the large green that says "Authorize AzurePipelines"
I am now able to select my GitHub Enterprise repositories when I create a new pipeline in Azure DevOps. I simply choose GitHub as the source where my repository lives.

GitHub Pages Automation

Overview:
I'm using GitHub Pages feature to host documentation. I'm working on a CI/CD process to automate the build so that when the source for the documentation is updated it automatically rebuilds the content and deploys to GitHub Pages.
Details:
So far, using AWS CodeBuild, I've implemented the following:
Pulls down source from GitHub Repo
Uses MkDocs to build and deploy to the special gh-pages branch using the "mkdocs gh-deploy" command.
This is done with command lines in the CodeBuild Buildspec. The reason I'm using commands is that I want to use GitHub Deploy Keys opposed to creating user account (used as a machine account) that my team would need to manage.
I have it all working except what triggers the build. If the process was using a user account to authenticate then I can use AWS CodePipeline which creates a Webhook within the GitHub repo, and then notifications are sent via the Webhook to say that the master branch was updated, which would trigger a new build.
I'd like to implement a similar process but using the GitHub repo's Deploy Key. Any suggestions?

Using Azure Powershell or the xpat cli how do I connect my web site to a github hook

Using the portal:
Using the portal at https://manage.windowsazure.com/ this is easy. From a newly created azure web site:
Go to the dashboard
On the quick glance options on the right, click "Set up deployment from source control"
On the "where is your source code?" option, select Github
Authorize, then choose the repo name and branch.
BINGO: now pushes to that branch will trigger a deployment of that branch onto the azure website. Lovely.
Here's the problem:
I cannot for the life of me see how to do this from the command line (using the xpat-cli installed using npm: "npm install azure-cli -g")
It seems like I should be typing something like:
azure site deployment github --verbose --githubusername [username] --githubrepository [username/reponame] [sitename]
Because the help for "azure site deployment github" says it will: "Link a website to a github account for deployment"
Doesn't seem to work though...
If I then type:
azure site show [sitename]
The output says the source control is "LocalGit" instead of github - which is what it says if I do it the portal way above.
Source Control
data: --------------
data: Type: LocalGit
Any ideas?
Depending on your use case the solution will be different.
Assuming you have the same github source but want to deploy to multiple different Azure websites
Potential Solution: Make use of the Deploy to Azure Button See details here: https://azure.microsoft.com/blog/2014/11/13/deploy-to-azure-button-for-azure-websites-2/
Assuming you have various repositories that you want to deploy to Azure: Potential Solution: I am assuming that you will be the person deploying it. The workflow will be as follows:
A. Download files from Github to local folder See here
B. Publish your local folder into a new/existing Azure site. See here, or here. There are other github repositories to get some scripts right away
I understand this doesnt directly hook your system to do direct pull, but its one way to do it.
There is also:
http://www.imtraum.com/blog/streamline-git-with-powershell/
https://gallery.technet.microsoft.com/scriptcenter/a-GitHub-Repository-265c0b49
Both documents I found describing how to set up continuous deployment from GitHub say that you can configure the repo and branch with an Azure Resource Manager template, but you have to enter your credentials and complete the authorization process in the portal.
The script used in this tutorial will automatically configure
continuous publishing from your GitHub repository. This requires that
your GitHub credentials are already stored in Azure, otherwise the
scripted deployment will fail when attempting to configure source
control settings for the web apps.
To store your GitHub credentials in Azure, create a web app in the
Azure preview portal and configure GitHub deployment. You only need to
do this once.
I'd also suggest posting your xpat-cli problem as an issue on their GitHub repo.