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.
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.
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
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:
sFTP
.Continuous deployment from a code repo
.Local Git
.Continuous deployment of a Docker image
.ZIP deploy
.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 theContinuous 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:Application resource shouldn’t know how it is deployed. Therefore, only
Docker-based
,ZIP Deploy
, andRun 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:
ZIP deploy
– Deploy files to App ServiceLocal Git
– Local Git deployment to Azure App ServiceContinuous deployment for a Docker image
– Migrate custom software to Azure App Service using a custom containersFTP
– Deploy your app to Azure App Service using FTP/SContinuous deployment from a code repo
– Continuous deployment to Azure App ServiceRun from package
– Run your app in Azure App Service directly from a ZIP packageIn 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.