skip to Main Content

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'
        }
        ...
      ]
      ...
    }
  }
}

2

Answers


  1. There are different deployment models for an App Service in Azure. They are exclusive. If you use one, you should ignore other ones.

    Deployment models for an App Service:

    1. sFTP.
    2. Continuous deployment from a code repo.
    3. Local Git.
    4. Continuous deployment of a Docker image.
    5. ZIP deploy.
    6. Run from package.

    So, if you deploy using Azure DevOps Pipeline you probably use #5 - ZIP deploy.

    "Source: Azure Repos" is for #2 - Continuous deployment from a code repo.

    They are mutually exclusive. You shouldn’t expect Disconnect (#2) to reappear after deploying by Azure DevOps Pipeline (#5).


    My subjective opinion:

    • sFTP is an ancient solution that shouldn’t be discussed. You need to manage SFTP connection. It’s not atomic.

    • Continuous deployment from a code repo is not for Production use. It deploys every change of the code, with no tests or infrastructure provisioning.

    • Local Git deployment is similar to the Continuous deployment from a code repo

    • Continuous deployment for a Docker image is a good solution for Docker-based approach. However, you might want to consider Container Apps instead of App Services for Docker.

    • ZIP deploy is an acceptable model that can and should be used from a CI/CD pipeline. Most commonly used approach.

    • Run from package can be a better approach due to advantages. Benefits:

      • Atomic deploys
      • Faster deployment
      • Reduced cold start for JavaScript-based apps

    Application resource shouldn’t know how it is deployed. Therefore, only Docker-based, ZIP Deploy, and Run from package approaches should be utilized for Production.

    Also, deployment stage should be a part of the CI/CD pipeline. Abovementioned approaches can be used in a pipeline (e.g., Azure Pipelines, GitHub Actions, etc.)


    Links:

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search