You can change the deployment method of your Azure App Service from local Git to using an Azure Container Registry (ACR) without needing to delete and recreate the App Service.
Steps to Change the Deployment Method
- Prepare Your Docker Container:
- Build and push your Docker image to the Azure Container Registry (ACR) or any other container registry.
- Update App Service to Use Docker Deployment:
- Go to the Azure portal, navigate to your App Service, and open the Deployment Center.
- Select Container as the deployment source.
- Configure the registry settings:
- Azure Container Registry: Select the ACR resource.
- Provide the image name and tag.
- If using an external registry, provide the appropriate credentials.
- Enable Continuous Deployment (Optional):
- If desired, enable continuous deployment to automatically update the app when the container image changes.
- Verify and Test:
- Restart the App Service and ensure it is correctly pulling and running the container.
If Deletion is Necessary If you need to delete and recreate the App Service (e.g., to clear deployment settings completely):
- Issues with Deleting and Recreating an App Service with the Same Name:
- Name Unavailability: Once an App Service is deleted, the name may not be immediately available due to backend cleanup. It might take a few minutes to hours before you can reuse the same name.
- DNS Propagation: If there are DNS records pointing to the old App Service, these may briefly resolve to a deleted resource.
- Cross-Tenant Consideration:
- Moving the resource to another subscription or tenant does not affect your ability to reuse the name in the same Azure region, as long as the name becomes available after deletion.
- Best Practice:
- Before deleting, ensure there is a backup or exported configuration of the App Service to easily recreate it.
- Consider using Infrastructure as Code (e.g., ARM templates, Bicep, or Terraform) to quickly redeploy with the same configurations.
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin