From 49386392c2ac8a975dd3260ee381b3e3c936216d Mon Sep 17 00:00:00 2001 From: Timothy Middelkoop Date: Thu, 2 Dec 2021 14:58:59 +0000 Subject: [PATCH] Reboot for scope change --- content/Azure/04_intro_to_cli.ipynb | 262 +++++++++++----------------- 1 file changed, 106 insertions(+), 156 deletions(-) diff --git a/content/Azure/04_intro_to_cli.ipynb b/content/Azure/04_intro_to_cli.ipynb index 2dec232..0d58806 100644 --- a/content/Azure/04_intro_to_cli.ipynb +++ b/content/Azure/04_intro_to_cli.ipynb @@ -58,47 +58,9 @@ "\n", "The cloud can also be controlled using a command line interface (CLI) or a programming language such as Python. Collectively these tools interact with the cloud over a Application Programming Interface (API) and this capability forms the basis of the cloud, the ability to control infrastructure programmatically. \n", "\n", - "For information about installing the Azure CLI for your OS see: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli\n", + "For information about installing the Azure CLI for your OS see: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli. If you are on your own OS you will need to login via `az login`.\n", "\n", - "The `az` command is used to control most aspects of Azure Cloud.\n", - "\n", - "First we need to login:" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1dff69af", - "metadata": {}, - "outputs": [], - "source": [ - "az login -u -p " - ] - }, - { - "cell_type": "markdown", - "id": "d7c44428", - "metadata": {}, - "source": [ - "If you want to avoid displaying your password on console and are using az login interactively, use the read -s command under bash." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "3710322e", - "metadata": {}, - "outputs": [], - "source": [ - "read -sp \"Azure password: \" AZ_PASS && echo && az login -u -p $AZ_PASS" - ] - }, - { - "cell_type": "markdown", - "id": "a0ac6e65", - "metadata": {}, - "source": [ - "or you can just use \"az login\" by itself and your default web browser will open a login window." + "The `az` command is used to control most aspects of Azure Cloud." ] }, { @@ -119,41 +81,27 @@ "name": "stdout", "output_type": "stream", "text": [ - "[\r\n", - " {\r\n", - " \"cloudName\": \"AzureCloud\",\r\n", - " \"homeTenantId\": \"67f4c504-a061-436d-ba6c-7a0fb76f6df8\",\r\n", - " \"id\": \"194bf392-269d-45de-89fc-ea9c8369fb94\",\r\n", - " \"isDefault\": false,\r\n", - " \"managedByTenants\": [],\r\n", - " \"name\": \"Azure subscription 1\",\r\n", - " \"state\": \"Enabled\",\r\n", - " \"tenantId\": \"67f4c504-a061-436d-ba6c-7a0fb76f6df8\",\r\n", - " \"user\": {\r\n", - " \"name\": \"1968posch912@gmail.com\",\r\n", - " \"type\": \"user\"\r\n", - " }\r\n", - " },\r\n", - " {\r\n", - " \"cloudName\": \"AzureCloud\",\r\n", - " \"homeTenantId\": \"78ea4b46-9f08-4ef5-949b-2dae057c55d8\",\r\n", - " \"id\": \"ae186240-1b93-42b5-bb33-e9b8c4e527de\",\r\n", - " \"isDefault\": true,\r\n", - " \"managedByTenants\": [],\r\n", - " \"name\": \"rece-dev\",\r\n", - " \"state\": \"Enabled\",\r\n", - " \"tenantId\": \"78ea4b46-9f08-4ef5-949b-2dae057c55d8\",\r\n", - " \"user\": {\r\n", - " \"name\": \"jhicks@internet2.edu\",\r\n", - " \"type\": \"user\"\r\n", - " }\r\n", - " }\r\n", - "]\r\n" + "[\n", + " {\n", + " \"cloudName\": \"AzureCloud\",\n", + " \"id\": \"975b9702-e6b9-47b5-94a5-ca5f2b110ca8\",\n", + " \"isDefault\": true,\n", + " \"name\": \"class-dev\",\n", + " \"state\": \"Enabled\",\n", + " \"tenantId\": \"78ea4b46-9f08-4ef5-949b-2dae057c55d8\",\n", + " \"user\": {\n", + " \"assignedIdentityInfo\": \"MSI\",\n", + " \"name\": \"systemAssignedIdentity\",\n", + " \"type\": \"servicePrincipal\"\n", + " }\n", + " }\n", + "]\n", + "\u001b[0m" ] } ], "source": [ - "!az account list" + "az account list" ] }, { @@ -170,7 +118,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "b8f74fe9-0943-4bd9-a91b-da09c001f8a1", "metadata": {}, "outputs": [], @@ -180,7 +128,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "id": "b937f6c7-3697-4bc0-8e32-da0b0faec593", "metadata": {}, "outputs": [ @@ -208,7 +156,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "id": "bae0587c-0379-40e3-9c31-16ba5505487a", "metadata": {}, "outputs": [ @@ -216,7 +164,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "student31\n" + "learner\n" ] } ], @@ -226,7 +174,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "id": "52b4add5-0d18-4faf-a304-b7e0ee8ba82e", "metadata": {}, "outputs": [ @@ -234,7 +182,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "cs-730348008320-default-default-kp946\n" + "essentials\n" ] } ], @@ -242,6 +190,14 @@ "echo \"${HOSTNAME}\"" ] }, + { + "cell_type": "markdown", + "id": "0be0c5dc-8f65-4749-a56b-f47bbdeb6106", + "metadata": {}, + "source": [ + "If you are using the cloudshell then your hostname will look similar to `cc-2510c465-7677c9dc4c-fcl8k`" + ] + }, { "cell_type": "markdown", "id": "ef895f38-ad16-4f2d-aa18-ec913732dd69", @@ -252,7 +208,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "id": "776806e4-209f-45fa-b14e-f771f5d5089d", "metadata": {}, "outputs": [ @@ -260,7 +216,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Tue 24 Aug 2021 03:15:21 PM UTC\n" + "Thu Dec 2 14:50:43 UTC 2021\n" ] } ], @@ -270,7 +226,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 8, "id": "560fde63-0eb8-4c52-9787-4debfe35ec23", "metadata": {}, "outputs": [ @@ -278,12 +234,12 @@ "name": "stdout", "output_type": "stream", "text": [ - "Date: Mon Sep 27 16:49:24 EDT 2021\r\n" + "Date: Thu Dec 2 14:50:52 UTC 2021\n" ] } ], "source": [ - "!echo \"Date: $(date)\"" + "echo \"Date: $(date)\"" ] }, { @@ -308,7 +264,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 9, "id": "d00a37e4", "metadata": {}, "outputs": [], @@ -319,7 +275,7 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": 10, "id": "d7988c45", "metadata": {}, "outputs": [ @@ -327,12 +283,12 @@ "name": "stdout", "output_type": "stream", "text": [ - "MyResourceGroup\r\n" + "MyResourceGroup\n" ] } ], "source": [ - "!echo $MYRG" + "echo $MYRG" ] }, { @@ -345,17 +301,17 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\r\n", - " \"id\": \"/subscriptions/ae186240-1b93-42b5-bb33-e9b8c4e527de/resourceGroups/MyResourceGroup\",\r\n", - " \"location\": \"eastus\",\r\n", - " \"managedBy\": null,\r\n", - " \"name\": \"MyResourceGroup\",\r\n", - " \"properties\": {\r\n", - " \"provisioningState\": \"Succeeded\"\r\n", - " },\r\n", - " \"tags\": null,\r\n", - " \"type\": \"Microsoft.Resources/resourceGroups\"\r\n", - "}\r\n" + "{\n", + " \"id\": \"/subscriptions/ae186240-1b93-42b5-bb33-e9b8c4e527de/resourceGroups/MyResourceGroup\",\n", + " \"location\": \"eastus\",\n", + " \"managedBy\": null,\n", + " \"name\": \"MyResourceGroup\",\n", + " \"properties\": {\n", + " \"provisioningState\": \"Succeeded\"\n", + " },\n", + " \"tags\": null,\n", + " \"type\": \"Microsoft.Resources/resourceGroups\"\n", + "}\n" ] } ], @@ -381,17 +337,17 @@ "name": "stdout", "output_type": "stream", "text": [ - "{\r\n", - " \"id\": \"/subscriptions/ae186240-1b93-42b5-bb33-e9b8c4e527de/resourceGroups/MyResourceGroup\",\r\n", - " \"location\": \"eastus\",\r\n", - " \"managedBy\": null,\r\n", - " \"name\": \"MyResourceGroup\",\r\n", - " \"properties\": {\r\n", - " \"provisioningState\": \"Succeeded\"\r\n", - " },\r\n", - " \"tags\": null,\r\n", - " \"type\": \"Microsoft.Resources/resourceGroups\"\r\n", - "}\r\n" + "{\n", + " \"id\": \"/subscriptions/ae186240-1b93-42b5-bb33-e9b8c4e527de/resourceGroups/MyResourceGroup\",\n", + " \"location\": \"eastus\",\n", + " \"managedBy\": null,\n", + " \"name\": \"MyResourceGroup\",\n", + " \"properties\": {\n", + " \"provisioningState\": \"Succeeded\"\n", + " },\n", + " \"tags\": null,\n", + " \"type\": \"Microsoft.Resources/resourceGroups\"\n", + "}\n" ] } ], @@ -435,41 +391,41 @@ "name": "stdout", "output_type": "stream", "text": [ - "[\r\n", - " {\r\n", - " \"id\": \"/subscriptions/ae186240-1b93-42b5-bb33-e9b8c4e527de/resourceGroups/cloud-shell-storage-eastus\",\r\n", - " \"location\": \"eastus\",\r\n", - " \"managedBy\": null,\r\n", - " \"name\": \"cloud-shell-storage-eastus\",\r\n", - " \"properties\": {\r\n", - " \"provisioningState\": \"Succeeded\"\r\n", - " },\r\n", - " \"tags\": null,\r\n", - " \"type\": \"Microsoft.Resources/resourceGroups\"\r\n", - " },\r\n", - " {\r\n", - " \"id\": \"/subscriptions/ae186240-1b93-42b5-bb33-e9b8c4e527de/resourceGroups/NetworkWatcherRG\",\r\n", - " \"location\": \"eastus\",\r\n", - " \"managedBy\": null,\r\n", - " \"name\": \"NetworkWatcherRG\",\r\n", - " \"properties\": {\r\n", - " \"provisioningState\": \"Succeeded\"\r\n", - " },\r\n", - " \"tags\": null,\r\n", - " \"type\": \"Microsoft.Resources/resourceGroups\"\r\n", - " },\r\n", - " {\r\n", - " \"id\": \"/subscriptions/ae186240-1b93-42b5-bb33-e9b8c4e527de/resourceGroups/MyResourceGroup\",\r\n", - " \"location\": \"eastus\",\r\n", - " \"managedBy\": null,\r\n", - " \"name\": \"MyResourceGroup\",\r\n", - " \"properties\": {\r\n", - " \"provisioningState\": \"Succeeded\"\r\n", - " },\r\n", - " \"tags\": null,\r\n", - " \"type\": \"Microsoft.Resources/resourceGroups\"\r\n", - " }\r\n", - "]\r\n" + "[\n", + " {\n", + " \"id\": \"/subscriptions/ae186240-1b93-42b5-bb33-e9b8c4e527de/resourceGroups/cloud-shell-storage-eastus\",\n", + " \"location\": \"eastus\",\n", + " \"managedBy\": null,\n", + " \"name\": \"cloud-shell-storage-eastus\",\n", + " \"properties\": {\n", + " \"provisioningState\": \"Succeeded\"\n", + " },\n", + " \"tags\": null,\n", + " \"type\": \"Microsoft.Resources/resourceGroups\"\n", + " },\n", + " {\n", + " \"id\": \"/subscriptions/ae186240-1b93-42b5-bb33-e9b8c4e527de/resourceGroups/NetworkWatcherRG\",\n", + " \"location\": \"eastus\",\n", + " \"managedBy\": null,\n", + " \"name\": \"NetworkWatcherRG\",\n", + " \"properties\": {\n", + " \"provisioningState\": \"Succeeded\"\n", + " },\n", + " \"tags\": null,\n", + " \"type\": \"Microsoft.Resources/resourceGroups\"\n", + " },\n", + " {\n", + " \"id\": \"/subscriptions/ae186240-1b93-42b5-bb33-e9b8c4e527de/resourceGroups/MyResourceGroup\",\n", + " \"location\": \"eastus\",\n", + " \"managedBy\": null,\n", + " \"name\": \"MyResourceGroup\",\n", + " \"properties\": {\n", + " \"provisioningState\": \"Succeeded\"\n", + " },\n", + " \"tags\": null,\n", + " \"type\": \"Microsoft.Resources/resourceGroups\"\n", + " }\n", + "]\n" ] } ], @@ -480,21 +436,15 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" + "display_name": "Bash", + "language": "bash", + "name": "bash" }, "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.7" + "codemirror_mode": "shell", + "file_extension": ".sh", + "mimetype": "text/x-sh", + "name": "bash" } }, "nbformat": 4,