Deploying to Azure from GitLab CI/CD?

We’re investigating whether to use GitLab for our issue tracking, source code management, and of course, CI/CD pipeline. One feature I can’t seem to find any documentation for is the ability to deploy to the Azure app service from GitLab. This is obviously integrated well into Azure DevOps and we really need it in GitLab as we need to deploy several Linux web apps to Azure.

The closest page I can find on this is: https://docs.gitlab.com/ee/ci/cloud_deployment/

But all it talks about is AWS; there’s no mention at all of Azure.

Is there any existing support/guides for deploying to Azure from GitLab? It seems to be a bit of an unloved area at the moment.

2 Likes

@jez any succes finding a solution so far?

This is what we’re doing - building and deploying Docker containers to Azure. The solution we’ve got is to use a bash script that runs the Azure CLI. For example:

RESOURCE_GROUP_NAME=$CI_PROJECT_NAME-$CI_ENVIRONMENT_SLUG
APPSERVICE_NAME=$RESOURCE_GROUP_NAME

az group create --name $RESOURCE_GROUP_NAME
az webapp create --name $APPSERVICE_NAME
az webapp config container set ....
etc.

You’ll need to configure a deployment token with read access to the registry, and these credentials are then available via the CI_DEPLOY_USER and CI_DEPLOY_PASSWORD variables.

We deploy into Australia East, so we are considering moving off of GitLab for the container registry, or at least augmenting it with an Azure Container Registry, so that our images are closer to our deployment sites.