Requirement | Instructions |
---|---|
Azure account | If you don't have one, create an account for free. You need the Contributor or Owner permission on the Azure subscription to proceed. Refer to Assign Azure roles using the Azure portal for details. |
GitHub Account | Sign up for free. |
git | Install git |
Azure CLI | Install the Azure CLI. |
az login
az upgrade
az extension add --name containerapp --upgrade
az provider register --namespace Microsoft.App
az provider register --namespace Microsoft.OperationalInsights
RG='your-rg-name'
LOCATION='your-preferred-location'
GITHUB_USERNAME='your-gh-username'
For this sample, we will be deploying a simple front end with a backend API to Azure Container Apps using the az containerapp up
command. Navigate to the following repo and fork.
Retrieve the necessary command to clone to your local machine. The command should look something like the following:
git clone https://github.com/$GITHUB_USERNAME/containerapps-albumapi-csharp.git code-to-cloud
Replace the variables with your GitHub username and the app language you would like to use. This command will clone the code into a directory called code-to-cloud
.
Change your directory to ensure you are pointed at the newly cloned repo
cd code-to-cloud
Let's experiment with one of the new capabilities of the az containerapp up
command. Recently, support was added for deploying from repos without a dockerfile present. Let's test it out and see how it works! Delete the file called dockerfile
from the repository.
az containerapp up --name album-api --source ./src -g $RG -l $LOCATION
- Creates a resource group.
- Creates an Azure Container Registry and an ACR task.
- Creates an Azure Log Analytics workspace.
- Creates an Azure Container Apps environment.
- Builds a container image and pushes it to the container registry.
- Creates an Azure Container App.
- Deploys the container to the container app.
az containerapp ingress enable -n album-api -g $RG --type external --target-port 8080 --transport auto