Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  1. Go to the dashboard
  2. On the quick glance options on the right, click "Set up deployment from source control"
  3. On the "where is your source code?" option, select Github
  4. Authorize, then choose the repo name and branch.
  5. 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?

like image 719
Nick Meldrum Avatar asked Jul 15 '15 07:07

Nick Meldrum


1 Answers

Depending on your use case the solution will be different.

  1. 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/

  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

like image 103
Sam Avatar answered Oct 04 '22 16:10

Sam