Search code examples
azureazure-web-app-serviceazure-pipelinesazure-repos

Azure app-service deployment center - what does the "Disconnect" do and how to "reconnect"?


I have an app-service that is hosting a FastAPI app in a container registry. The image below is the Settings page of the app-service's Deployment Center in Azure.

enter image description here

I clicked on it to see all the options otherwise hidden and now I can't undo it. It took about 20 seconds to process the "disconnect" command and, and although I AM deploying the app using Azure DevOps CICD pipelines, the "Azure Repos" connection is not restored.

The documentation doesn't say much and the screenshots seem outdated. It says though that for Azure Pipelines there's nothing to configure in Azure Portal, only in Azure DevOps, which is already done, and I expected to see again the Disconnect button after the next deployment -- didn't happen.

enter image description here

I'm trying to understand what exactly did I do (this is a dev/test environment, by the way). I would also prefer the "Disconnect" button back, at least it indicates that a connection exists.

Edit: @wadezhou-MSFT this is the deployment task:

- task: Docker@2
  displayName: login to ACR
  inputs:
     command: login
     repository: $(acrImageName)
     containerRegistry: "$(dockerRegistryServiceConnectionDev)"
- script: |
     docker pull $(dev_docker_registry_name)/$(acrImageName):$(tag)
     docker tag $(dev_docker_registry_name)/$(acrImageName):$(tag) $(dev_docker_registry_name)/$(acrImageName):latest
     docker push $(dev_docker_registry_name)/$(acrImageName):latest
  displayName: Build and push dev image

The app-service is deployed using bicep with Azure CLI (used to be a AzureResourceManagerTemplateDeployment@3 task before):

resource appService 'Microsoft.Web/sites@2023-01-01' = {
  name: appServiceName
  location: location
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    serverFarmId: appPlan.id
    httpsOnly: true
    clientAffinityEnabled: false
    siteConfig: {
      ftpsState: 'Disabled'
      minTlsVersion: '1.2'
      scmType: 'VSTSRM'
      linuxFxVersion: linuxFxVersion
      appCommandLine: dockerRegistryStartupCommand
      appSettings: [
        {
           name: 'WEBSITE_RUN_FROM_PACKAGE'
           value: '1'
        }
        {
           name: 'WEBSITE_ENABLE_SYNC_UPDATE_SITE'
           value: 'true'
        }
        ...
      ]
      ...
    }
  }
}

Solution

  • In your pipeline yaml, it only logins to ACR, build image and push it to ACR, not related to the app service yet.

    You are deploying web service via Azure CLI with bicep, not found any sourcecontrols in your bicep. The connection cannot be created if you rerun the pipeline as you are not deploying from pipeline. Try to deploy from pipeline to check the connection again.

    Sample yaml:

        - task: Docker@2
          displayName: Build and push an image to container registry
          inputs:
            containerRegistry: '$(dockerRegistryServiceConnection)'
            repository: '$(imageRepository)'
            command: 'buildAndPush'
            Dockerfile: '**/Dockerfile'
            tags: '$(tag)'
    
        - task: AzureWebAppContainer@1
          inputs:
            azureSubscription: 'ARMConn6'
            appName: 'wadeapp3'
            containers: '$(containerRegistry)/$(imageRepository):$(tag)'
    

    Click view log in overview page on app service, it will direct to deployment center details, but as @VladDX mentioned, not registry settings content but repo content.

    enter image description here

    If use azure cli such as az webapp create --name Dev-App \ --plan Dev-AppServicePlan \ --resource-group chat-Dev \ --deployment-container-image-name devcontainerregistry.azurecr.io/chat-node:latest,on deployment center , it will be:

    enter image description here