Deploy a sample application to the Azure Container Registry (ACR) and ensure it's ready for further use in your Azure environment.
- Build and run the Docker image on your local machine. Follow the instructions here.
- Verify the application's functionality
- Confirm the application runs without errors locally
- Why is local testing important before deploying to ACR?
We aim to run the Docker build and publish the image directly to the Azure Container Registry created in lab 2.
- Create a new service connection for ACR access that will authenticate using Workload Identity federation.
- In your Azure DevOps Project, go to Project Settings.
- Select Service Connections.
- Click New Service Connection and choose Docker Registry.
- Select the registry type: Azure Container Registry.
- Choose the correct ACR and create a service connection name. For example, devopsjourneyoct2024acr
- Confirm the service connection is created and functional
- Why is Workload Identity federation preferred for authentication?
- Update pipeline in Azure DevOps repo with the below updates:
- Updated variables
- repository: ACR repository name
- dockerfile: Dockerfile location
- containerRegistry: Service connection name of container registry
- Add Build Stage
- Copy the
app
folder to your Azure DevOps repository.
- Ensure all necessary files are present in the repository.
- How does storing application code in the same repository as pipeline code benefit the project?
- What is the purpose of each variable you're updating?
- Run pipeline, you will see an additional stage on pipeline
- Reviewing in ACR, you will see the image
- Confirm the new stage completes successfully
- Check ACR for the newly pushed image
- How would you troubleshoot if the new stage fails?