I have an Azure pipeline which builds an asp-net core project and build from it a docker image and push it to Azure Container Registry.
This pipeline is made from an azure-pipelines.acr.yml
file. Each git push operation that I perform to my Deployments branch is turned it in a new build into my pipeline.
Until here I have a CI pipeline, in order to integrate each new change in the master branch to my pipeline.
But, after to finish each build, I have to run a new instance of that image pushed into my container registry, and deploy it as a new App service, all this process manually from Azure portal services.
I have been reading and that's I need is perform a continuous deployment using my Azure pipeline. In my azure-pipelines.acr.yml
I have the CI pipeline workflow with the following steps:
pool:
vmImage: 'ubuntu-16.04' # other options: 'macOS-10.13', 'vs2017-win2016'
variables:
buildConfiguration: 'Release'
imageName: 'zcrm365:$(Build.BuildId)'
dockerId: 'zcrm365' # This is my registry name access key
dockerPassword: 'my password' # Password access key
# I should create an environment variables to dockerId and dockerPassword
steps:
# Build a docker image
- script: |
docker build -t $(dockerId)/$(imageName) -f ZAccountSyncService/Dockerfile . # add options to this command to meet your needs
docker build -t $(dockerId).azurecr.io/$(imageName) -f ZAccountSyncService/Dockerfile .
docker login -u $(dockerId) -p $(dockerPassword) $(dockerId).azurecr.io
docker images
docker push $(dockerId).azurecr.io/$(imageName)
##### DEPLOY A WEB APP ########
- script: dotnet publish --output $(Build.ArtifactStagingDirectory)
# Publish the output of our build to Azure Pipelines
- task: PublishBuildArtifacts@1
- task: DotNetCoreCLI@2
inputs:
command: publish
# our repository seems has no web project
publishWebProjects: False
# We should specify your .csproj in project(s) option.
projects: ""
arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactStagingDirectory)'
zipAfterPublish: True
# CREATING AN Azure App Service Deploy task
- task: AzureRmWebAppDeployment@3
inputs:
# Is this my ID Subscription?
azureSubscription: '4e65758d-dbf5-456f-bb55-6b92273772dd'
WebAppName: 'zcrm-365'
Package: $(System.ArtifactsDirectory)/**/*.zip
And, in my build pipeline, I get this output error:
Job Job: Step input azureSubscription references service connection ID SUBSCRIPTION which could not be found. The service connection does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz.
I am trying this process and I have an Azure Subscription active, but, I cannot setup the connection to it.
How to can I setup my service connection in order to connect to Azure Resource Manager and may be create my app service?
The idea is make this step in order to advance to the creation of my release pipeline with the CI process that I am performing.