How to create CD in self-hosted GitLab for publishing on azure app service?

Viewed 185

I have created a project in Net core(v3.1) and publish it on internal GitLab.I have admin rights for that project so I have register CI/CD for that using GitLabRunner.

If I want to create publish file for my local folder then it works fine but now I want to publish a web application to the Azure app service.

I am using this command to login to Azure. az login -u <mymsemail> -p <mypassword>. This command return ERROR: Get Token request returned http error: 400 and if I execute this same command in cmd then it works fine.

If anyone has any idea about this then please let me know as I am stuck here for more than 2 days. I also attach my .gitlab-ci.yml file below.

default:
    image: mcr.microsoft.com/dotnet/core/sdk:3.1
    tags: 
        - ci
stages:
  - build
  - deploy

build:
   stage: build
   script:
       - dotnet restore --no-cache --force
       - dotnet build -c Release --no-restore

deploy:
  stage: deploy
  script:
    # - apt-get update
    # - apt-get -y install zip
    #- curl -sL https://aka.ms/InstallAzureCLIDeb | powershell
    - az account clear
    - az login -u <Email> -p <Password> --tenant <TenantID>
    - az webapp deployment source config-local-git --name <appservicename> --resource-group <resourceGroupName>
  only:
    - master

System and Project Configuration:

OS: Windows 10 Pro

Software: Visual Studio 2019 Enterprise, .Net CLI

Project: Individual User Account .Net Core (v3.1)

If there is any suggestion regarding this then please let me know.

0 Answers
Related