Azure Infrastructure Including Docker Flashcards
How would you use Powershell for creating an Azure Container Instance to run an ASP.NET CORE application hosted in Docker Hub
#Create a new resource group by name New-AzResourceGroup -Name myResourceGroup `-Location WestUs
#Create a container group in the resource group #with the name of the service #Do NOT use New-AzContainerService - this is for a kubernetes swarm and is deprecated #Use Azure Kubernetes Services to manage Kubernetes clusters
New-AzContainerGroup `
-ResourceGroupName myResourceGroup `
-Name mycontainer `
#Image path in docker hub: company/user/imagename
-Image mcr.microsoft.com/windows/servercore/iis:nanoserver -OsType Windows
#DNS name label for the IP address.
#creates a mapping for aci-demo-win.location.cloudapp.azure.com
#to the public IP in the Azure-managed DNS.
-DnsNameLabel aci-demo-win
https://docs.microsoft.com/en-us/azure/container-instances/container-instances-quickstart-powershell
How would you use Azure CLI for creating an Azure Docker Container Instance to run an ASP.NET CORE application
#Create a resource group az group create --name myResourceGroup --location eastus
az container create
- -resource-group myResourceGroup
- -name mycontainer
- -image mcr.microsoft.com/azuredocs/aci-helloworld
- -dns-name-label aci-demo
- -ports 80
Using an ARM template to create a docker container, what are the correct values for the missing paramaters:
{ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "[PARAETER-A]": { "type": "string", "defaultValue": "acilinuxpublicipcontainergroup", "metadata": { "description": "Name for the container group" } }, "[PARAMATER-B]": { "type": "string", "defaultValue": "mcr.microsoft.com/azuredocs/aci-helloworld", "metadata": { "description": "Container image to deploy. Should be of the form repoName/imagename:tag for images stored in public Docker Hub, or a fully qualified URI for other registries. Images from private registries require additional registry credentials." } }, "[PARAETER-C]": { "type": "string", "defaultValue": "80", "metadata": { "description": "Port to open on the container and the public IP address." } }, "[PARAETER-D]": { "type": "string", "defaultValue": "1.0", "metadata": { "description": "The number of CPU cores to allocate to the container." } }, "[PARAETER-E]": { "type": "string", "defaultValue": "1.5", "metadata": { "description": "The amount of memory to allocate to the container in gigabytes." } }, "[PARAETER-F]": { "type": "string", "defaultValue": "[resourceGroup().location]", "metadata": { "description": "Location for all resources." } }, "[PARAETER-G]": { "type": "string", "defaultValue": "always", "allowedValues": [ "never", "always", "onfailure" ], "metadata": { "description": "The behavior of Azure runtime if container has stopped." } } }, "resources": [ { "type": "Microsoft.ContainerInstance/containerGroups", "apiVersion": "2019-12-01", "name": "[parameters('name')]", "location": "[parameters('location')]", "properties": { "containers": [ { "name": "[parameters('name')]", "properties": { "image": "[parameters('image')]", "ports": [ { "port": "[parameters('port')]" } ], "resources": { "requests": { "cpu": "[parameters('cpuCores')]", "memoryInGb": "[parameters('memoryInGb')]" } } } } ], "osType": "Linux", "restartPolicy": "[parameters('restartPolicy')]", "ipAddress": { "type": "Public", "ports": [ { "protocol": "Tcp", "port": "[parameters('port')]" } ] } } } ], "outputs": { "containerIPv4Address": { "type": "string", "value": "[reference(resourceId('Microsoft.ContainerInstance/containerGroups/', parameters('name'))).ipAddress.ip]" } } }
A: name B: image C: port D: cpuCores E: memoryInGb F: location G: restartPolicy
https://docs.microsoft.com/en-us/azure/container-instances/container-instances-quickstart-template
You have developed an application that uses Redis to support a front end Web App that you want to make available in your companies private azure container registry:
myregistry.azurecr.io
You decide to deploy an instance to Azure using Docker Compose.
You configure your docker compose file to prepare for uploading your solution to the registry:
1: What value should you use for the path to the image that will hold a Web App named azure-vote-front?
2: What value should you give so that this container can access the Redis server in the azure-vote-back container?
version: '3' services: azure-vote-back: image: mcr.microsoft.com/oss/bitnami/redis:6.0.8 container_name: azure-vote-back environment: ALLOW_EMPTY_PASSWORD: "yes" ports: - "6379:6379"
azure-vote-front: {parameter1} build: ./azure-vote image: container_name: azure-vote-front environment: REDIS: {parameter2} ports: - "80:80"
1: myregistry.azurecr.io/azure-vote-front
2: azure-vote-back
To run this from on your local machine for testing you would run:
docker-compose up –build -d
To push it to the private container registry you would run
docker-compose push
you may need to login first - using
az acr login –name myregistry.azurecr.io
You have an empty DotNet Core Web app running in a resource group, you need to configure it to run code from a docker image hosted in Docker Hub
Using the following Azure cli code:
az webapp config container set –docker-custom-image-name $dockerHubContainerPath –name $appName –resource-group myResourceGroup
What would the correct variable be for dockerHubContainerPath
A: company1/asp-app
B: company1.azurecr.io/asp-app
A: company1/asp-app
Docker Hub repository uses the conventions
company/user/image
company1. azurecr.io would refer to an Azure Container Registry (ACR) not Docker Hub
https: //docs.microsoft.com/en-us/azure/app-service/scripts/cli-linux-docker-aspnetcore
You have an empty DotNet Core Web app running in a resource group, you need to configure it to run code from a docker image hosted in Docker Hub
Using the following Azure cli code, what would be the correct value for :
az webapp [Missing Code here] –docker-custom-image-name company1/asp-app –name myApp –
resource-group myResourceGroup
A: config set
B: config container set
B: config container set
config set would affect WebApp general settings such as alwaysOn or number of workers
If you have a DotNet Core application running in a docker container, and you would like to add a backend service such as Redis, how can you ensure a solution without incurring additional cost?
Use Azure Container Instance (ACI) Container Groups.
These provide the ability to have multiple container images on the same host machine.
Each deployed container image can communicate with each other via localhost
You can use az container create to update properties on an existing container
Which Azure support plan is best for business-critical workloads?
A: Azure Developer
B: Azure Professional Direct
C: Azure Standard
B Azure Professional Direct support plan is best for business-critical workloads. This support plan offers 1-hour response time and priority tracking of critical cases.
Azure Standard support plan offers 1-hour response time for critical cases and is best for Production workload environments
Azure Developer support plan offers one business day response time and is best for non-critical workloads.
What is the azure cli parameter for setting the git repository url on a webapp?
az webapp source config –name $webApp –resource-group $group [Parameter] $gitRepo –branch master –manual-intergration
A: –repo-url
B; –github-deploy
C: –github-repo
D: –repo-deploy
A: –repo-url
# Deploy code from a public GitHub repository. az webapp deployment source config --name $webappname --resource-group myResourceGroup \ --repo-url $gitrepo --branch master --manual-integration
https://docs.microsoft.com/en-us/azure/app-service/scripts/cli-deploy-github
–manual-integration
Disables automatic sync between source control and web.
True or False
Filesystem and Blob storage application logging options are supported for both Windows and Linux Apps?
False
Filesystem storage is the only storage option supported for application logging in Linux apps.
True or False
When using Blob Storage application logging, the blob store storage account must be in the same region as the App
True
The storage account must be in the same region as the App Service
True or False
File system storage is perfect for long term logging, and is enabled for as long as the App is running
False
File system storage is designed for short term storage and turns itself off after 12 hours.
You are developing an ASP.NET Core application running in an Azure App Service Web App named webapp1.
The Web App is running in a App Service Plan in the standard tier named plan1 within a resource group name group1. Webapp1 is the only Web App running in plan1.
You need to monitor the CPU usage of Webapp1, and create an alert if the usage percentage is above 70 percent.
Which resource and metric should you use?
Resource:
group1
plan1
webapp1
Metric
Average Response Time
CPU Percentage
CPU Time
You should use the CPU Percentage metric. This metric contains CPU usage over time for any given App Service Plan. You need to use this metric to configure the alert properly.
You should use the plan1 resource. To monitor the CPU usage of an App Service, you need to choose the App Service Plan resource, which is the plan1 resource in this case. An App Service Plan resource contains the metrics related to virtual machine (VM) usage, like CPU Percentage, MemoryPercentage, and Disk Queue Length.
You should not use the webapp1 or group1 resources. To monitor the CPU usage of an App Service, you need to choose the App Service Plan resource, which is the plan1 resource in this scenario.
You should not use the CPU Time metric. This metric indicates the amount of CPU time in seconds consumed by the Web App. You should use this metric to monitor the CPU usage of Web Apps running in App Service Plans with quota restriction, like the Free and Shared plans. Webapp1 runs in a Standard tier App Service Plan.
You should not use the Average Response Time metric. This metric measures the average time the app takes to serve requests, in seconds. This is not directly related to CPU usage.
https://docs.microsoft.com/en-us/azure/app-service/web-sites-monitor
How can you monitor the performance of a web application on your companies corporate network from many locations around the world?
Create a URL Ping Test in Application Insights
This allows you to test from up to 17 geographical locations.
You can set the test frequency to 5, 10 or 15 minute intervals,
You can configure the test to notify you if a responsedoes not indicate success, contain certain content, or a response is not received within a particular time frame
If you want to pulish the most recent version of a third party image to your Azure Container Registy which command should you use?
A: az acr import -n myReg –source $thirdPatyImageSource -t sevice:latest
B az acr update -n myReg –source $thirdPatyImageSource -t sevice:latest
A: az acr import -n myReg –source $thirdPatyImageSource -t sevice:latest
This imports the latest image into the ACR and publish it to myreg1. The -t parameter specifies the target image name.
You should not use az acr update
this is for updating parameters such as tags, or enabling an administration account