Azure Infrastructure Including Docker Flashcards

1
Q

How would you use Powershell for creating an Azure Container Instance to run an ASP.NET CORE application hosted in Docker Hub

A
#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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How would you use Azure CLI for creating an Azure Docker Container Instance to run an ASP.NET CORE application

A
#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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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"
A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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

A

B: config container set

config set would affect WebApp general settings such as alwaysOn or number of workers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which Azure support plan is best for business-critical workloads?

A: Azure Developer
B: Azure Professional Direct
C: Azure Standard

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

True or False

Filesystem and Blob storage application logging options are supported for both Windows and Linux Apps?

A

False

Filesystem storage is the only storage option supported for application logging in Linux apps.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

True or False

When using Blob Storage application logging, the blob store storage account must be in the same region as the App

A

True

The storage account must be in the same region as the App Service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

True or False

File system storage is perfect for long term logging, and is enabled for as long as the App is running

A

False

File system storage is designed for short term storage and turns itself off after 12 hours.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How can you monitor the performance of a web application on your companies corporate network from many locations around the world?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

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

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

If you want to monitor and alert on the performance of an Azure Web App , should you attach the CPU Percentage Metric to:

A: The Rsource Group
B: The Web App
C: The App Service Plan

A

C: The App Service Plan

The plan covers all items in the resource group which may consume CPU, it also includes Cpu Time, Cpu Percentage, Memory Percentage and Disk Queue Length

17
Q

You are deploying a website in Docker and need to listen on port 80 and port 443

At what point in the Docker build file should you configure the server?

A: First thing before you build and publish the app
B: At the end of the script before you set the endpoint
C: At the end of the script after you set the endpoint

A

A: First thing before you build and publish the app

Configuring the server and the ports looks like:

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-nanoserver-1903 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

After you have built and pubished the app, you can then copy the published dll into the base container

FROM base AS final
WORKDIR /app
COPY –from=publish /app/publish .
ENTRYPOINT [“dotnet”, “WebApplication1.dll”]

other server runtime instances include

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base

Which is the Debian linux image

debian: stretch-slim,
ubuntu: bionic, alpine:3.8, and alpine:3.9.

18
Q

You are creating an App Service web app that must authenticate users with Google. The URL of the app is https://mup.azurewebsites.net. You enable App Service Authentication in the Azure Portal.

You need to specify the redirect URL when you register your app with Google.

Which URL should you specify?

A: https://mup.azurewebsites.net/callback/auth
B: https://mup.azurewebsites.net/.auth/login/google/callback
C: https://mup.azurewebsites.net/google/callback
D: https://mup.azurewebsites.net/google

A

B: https://mup.azurewebsites.net/.auth/login/google/callback

For App Service apps with authentication enabled, the callback URL is always the URL of your app that is appended with .auth/login/{provider}/callback.

When the redirect occurs, Azure is responsible for taken the token information and adding it to request headers

Support for any OpenID Connect provider is in Preview
currently the following providers are supported

Azure Active Directory 	/.auth/login/aad
Microsoft Account 	/.auth/login/microsoftaccount
Facebook 	/.auth/login/facebook
Google 	/.auth/login/google
Twitter 	/.auth/login/twitter
19
Q

To bind a deployment slot to a github repository which cli command should you use?

A: az webapp deployment slot config
B: az webapp deployment source config

A

az webapp deployment source config

use the –repo-url parameter to set the URl
use the –branch parameter to set the Branch

20
Q

If you want to dploy a WebApp for containers
once you have configured the Group and Plan what should you configure next?

A: az container create
B: az webapp create

A

B: az webapp create

This conifgures a web app for containers
Use the -i parameter to set the source image from DockerHub

eg: -i nginx