Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure github etc for Azure via Powershell

Is it possible to configure a source control repository to deploy code to an Azure Web App slot via Powershell. (or even just the primary site)

Ideally for v2 / ARM but I'm willing to consider anything at the moment!

I have looked through the commands available in AzureRM.Websites module and there doesn't appear to be anything.

P.S. I know this is possible via template, I am currently looking for pure Powershell commands.

like image 676
Michael B Avatar asked Jan 03 '16 00:01

Michael B


1 Answers

You can do it using the 'low level' ARM CmdLets. e.g. for the main site:

$props = @{
    RepoUrl = $repoUrl
    Branch = "master"
}

New-AzureRmResource -ResourceGroupName $ResourceGroupName -ResourceType Microsoft.Web/sites/SourceControls -Name $SiteName/Web -PropertyObject $props -ApiVersion 2015-08-01 -Force

And for a slot (using same $props):

New-AzureRmResource -ResourceGroupName $ResourceGroupName -ResourceType Microsoft.Web/sites/slots/sourcecontrols -Name $SiteName/$SlotName/Web -PropertyObject $props -ApiVersion 2015-08-01 -Force

See also sample helper method here. That one sets IsManualIntegration = true, which is for repos you don't own, and requires a manual sync. For continuous deployment, leave IsManualIntegration out.

like image 136
David Ebbo Avatar answered Sep 23 '22 03:09

David Ebbo