I would like to setup continuous deployment from a GitLab repository to an Azure App using a PowerShell script. I\'m aware that you can do this manually as per:
http
Assuming the repository is public you could use the following:
$gitrepo=""
$webappname="mywebapp$(Get-Random)"
$location="West Europe"
# Create a resource group.
New-AzureRmResourceGroup -Name myResourceGroup -Location $location
# Create an App Service plan in Free tier.
New-AzureRmAppServicePlan -Name $webappname -Location $location `
-ResourceGroupName myResourceGroup -Tier Free
# Create a web app.
New-AzureRmWebApp -Name $webappname -Location $location -AppServicePlan $webappname `
-ResourceGroupName myResourceGroup
# Configure deployment from your repo and deploy once.
$PropertiesObject = @{
repoUrl = "$gitrepo";
branch = "master";
isManualIntegration = $true
}
Set-AzureRmResource -PropertyObject $PropertiesObject -ResourceGroupName myResourceGroup `
-ResourceType Microsoft.Web/sites/sourcecontrols -ResourceName $webappname/web `
-ApiVersion 2018-02-01 -Force
Let me know if it's private, that may be more difficult. If you look at the CLI source you can see they currently only support access tokens with GitHub.
https://github.com/Azure/azure-cli/blob/4f87cb0d322c60ecc6449022467bd580a0accd57/src/command_modules/azure-cli-appservice/azure/cli/command_modules/appservice/custom.py#L964-L1027