Azure 101⚓︎
Difficulty:
Direct link: Objective URL
Objective⚓︎
Request
Help Sparkle Redberry with some Azure command line skills. Find the elf and the terminal on Christmas Island.
Sparkle Redberry
Hey, Sparkle Redberry here! So, I've been trying to learn about Azure and the Azure CLI and it's driving me nuts.
Alabaster Snowball decided to use Azure to host some of his fancy new IT stuff on Geese Islands, and now us elves have to learn it too.
Hints⚓︎
Azure CLI Reference
https://learn.microsoft.com/en-us/cli/azure/reference-index?view=azure-cli-latest
Solution⚓︎
For this task, interaction with Azure resources is required. All answers need to be entered into terminal.
Q1. You may not know this but the Azure cli help messages are very easy to access. First, try typing:
$ az help | less
Q2. Next, you've already been configured with credentials. Use 'az' and your 'account' to 'show' your current details and make sure to pipe to less ( | less )
az account show | less
Output
{
"environmentName": "AzureCloud",
"id": "2b0942f3-9bca-484b-a508-abdae2db5e64",
"isDefault": true,
"name": "northpole-sub",
"state": "Enabled",
"tenantId": "90a38eda-4006-4dd5-924c-6ca55cacc14d",
"user": {
"name": "northpole@northpole.invalid",
"type": "user"
}
}
Q3. Excellent! Now get a list of resource groups in Azure.
az group list
Output
[
{
"id": "/subscriptions/2b0942f3-9bca-484b-a508-abdae2db5e64/resourceGroups/northpole-rg1",
"location": "eastus",
"managedBy": null,
"name": "northpole-rg1",
"properties": {
"provisioningState": "Succeeded"
},
"tags": {}
},
{
"id": "/subscriptions/2b0942f3-9bca-484b-a508-abdae2db5e64/resourceGroups/northpole-rg2",
"location": "westus",
"managedBy": null,
"name": "northpole-rg2",
"properties": {
"provisioningState": "Succeeded"
},
"tags": {}
}
]
Q4. Ok, now use one of the resource groups to get a list of function apps. For more information:
az functionapp list -g northpole-rg1
Output
[
{
"appServicePlanId": "/subscriptions/2b0942f3-9bca-484b-a508-abdae2db5e64/resourceGroups/northpole-rg1/providers/Microsoft.Web/serverfarms/EastUSLinuxDynamicPlan",
"availabilityState": "Normal",
"clientAffinityEnabled": false,
"clientCertEnabled": false,
"clientCertExclusionPaths": null,
"clientCertMode": "Required",
"cloningInfo": null,
"containerSize": 0,
"customDomainVerificationId": "201F74B099FA881DB9368A26C8E8B8BB8B9AF75BF450AF717502AC151F59DBEA",
"dailyMemoryTimeQuota": 0,
"defaultHostName": "northpole-ssh-certs-fa.azurewebsites.net",
"enabled": true,
"enabledHostNames": [
"northpole-ssh-certs-fa.azurewebsites.net"
],
"extendedLocation": null,
--- CODE OMITTED ---
Q5. Find a way to list the only VM in one of the resource groups you have access to.
az vm list -g northpole-rg2
Output
[
{
"id": "/subscriptions/2b0942f3-9bca-484b-a508-abdae2db5e64/resourceGroups/northpole-rg2/providers/Microsoft.Compute/virtualMachines/NP-VM1",
"location": "eastus",
"name": "NP-VM1",
"properties": {
"hardwareProfile": {
"vmSize": "Standard_D2s_v3"
},
"provisioningState": "Succeeded",
"storageProfile": {
"imageReference": {
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "16.04-LTS",
"version": "latest"
},
"osDisk": {
"caching": "ReadWrite",
"createOption": "FromImage",
"managedDisk": {
"storageAccountType": "Standard_LRS"
},
"name": "VM1_OsDisk_1"
}
},
"vmId": "e5f16214-18be-4a31-9ebb-2be3a55cfcf7"
},
"resourceGroup": "northpole-rg2",
"tags": {}
}
]
!!! question "Q6. Find a way to invoke a run-command against the only Virtual Machine (VM) so you can RunShellScript and get a directory listing to reveal a file on the Azure VM. For more information:"
az vm run-command invoke -g northpole-rg2 -n NP-VM1 --command-id RunShellScript --scripts "ls -la"
{
"value": [
{
"code": "ComponentStatus/StdOut/succeeded",
"displayStatus": "Provisioning succeeded",
"level": "Info",
"message": "total 52\ndrwxr-x--- 1 0 0 4096 Dec 4 20:38 .\ndrwxr-x--- 1 0 0 4096 Dec 4 20:38 ..\ndrwxr-x--- 1 0 0 4096 Dec 4 20:37 bin\ndrwxr-xr-x 1 0 0 4096 Dec 4 20:38 etc\ndrwxr-x--- 1 0 0 4096 Dec 2 22:16 home\n-rwxr-x--- 1 0 0 0 Dec 4 20:37 jinglebells\ndrwxr-xr-x 1 0 0 4096 Dec 4 20:37 lib\ndrwxr-xr-x 1 0 0 4096 Dec 4 20:37 lib64\ndrwxr-xr-x 1 0 0 4096 Dec 4 20:37 usr\n",
"time": 1703761045
},
{
"code": "ComponentStatus/StdErr/succeeded",
"displayStatus": "Provisioning succeeded",
"level": "Info",
"message": "",
"time": 1703761045
}
]
}
Once completed, we can close terminal!
Response⚓︎
Sparkle Redberry
Wow, you did it!