Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Sample ASP.NET Core app

This is a small, container-ready version of an API consumer

export API_CONSUMER_BaseUrl=...
export API_CONSUMER_ExternalApplicationCode=...
export API_CONSUMER_PreSharedKey=...
export API_CONSUMER_EventCode=...

You can run the container locally to test:

docker run -d -e API_CONSUMER_BaseUrl -e API_CONSUMER_ExternalApplicationCode -e API_CONSUMER_PRESHAREDKEY -e API_CONSUMER_EventCode -p 1493:80/tcp  api-consumer:1.0.0

On Container instances

az group create --name sampleContainerRegistryGroup --location westeurope
az acr create --resource-group sampleContainerRegistryGroup --name sampleContainerRegistry --sku Basic
az acr update -n sampleContainerRegistry --admin-enabled true
az acr login --name sampleContainerRegistry
az acr list --resource-group sampleContainerRegistryGroup --query "[].{acrLoginServer:loginServer}" --output table
docker tag sample-api-consumer:1.0.0 samplecontainerregistry.azurecr.io/sample-api-consumer:1.0.0
docker push samplecontainerregistry.azurecr.io/sample-api-consumer:1.0.0
az acr credential show --name sampleContainerRegistry --query "passwords[0].value"

Note - I actually had to use password 2 here

az provider register --namespace Microsoft.ContainerInstance
az container create --resource-group sampleContainerRegistryGroup --name sample-api-consumer --image samplecontainerregistry.azurecr.io/sample-api-consumer:1.0.0 --cpu 1 --memory 1 --registry-password ... --ip-address public --ports 80 --environment-variables API_CONSUMER_BaseUrl=... API_CONSUMER_ExternalApplicationCode=... API_CONSUMER_PRESHAREDKEY=... API_CONSUMER_EventCode=...

az container logs --resource-group sampleContainerRegistryGroup --name sample-api-consumer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.