diff --git a/lessons/08_cloud_intro/01_azure_intro.md b/lessons/08_cloud_intro/01_azure_intro.md new file mode 100644 index 0000000..1396ba6 --- /dev/null +++ b/lessons/08_cloud_intro/01_azure_intro.md @@ -0,0 +1,219 @@ +# Week 2 — Hands-On with Microsoft Azure + +## **Lesson Overview** +Welcome to the cloud! ☁️ +In this lesson, you’ll take your very first hands-on steps into **Microsoft Azure**, one of the world’s leading cloud platforms. You’ll learn to log into the Azure Portal, explore Cloud Shell, use the Azure CLI, and even write and run your first Python script directly in the cloud. + +By the end, you’ll not only understand how to navigate Azure — you’ll *feel like a real cloud engineer.* + +--- + +## **Learning Objectives** +By the end of this lesson, you will be able to: +- Log into the Azure Portal and identify its main features. +- Launch and use Azure Cloud Shell (Bash). +- Navigate the Cloud Shell filesystem. +- Use Azure CLI commands to explore your subscription and resources. +- Write and execute a Python script directly in the cloud. +- Understand alternative ways to work with Azure. + +--- + +## **Table of Contents** +1. Introduction to the Azure Portal + - 1.1 What Is the Azure Portal + - 1.2 Logging In and Exploring +2. Working in the Cloud Shell + - 2.1 Getting Started with Cloud Shell + - 2.2 Exploring the Filesystem + - 2.3 Running Azure CLI Commands + - 2.4 Using the Cloud Shell Editor +3. Executing Python in the Cloud +4. Other Ways to Work with Azure +5. Wrap-Up & Next Steps + +--- + +## **1.1 What Is the Azure Portal** + +Before we dive into commands and code, let’s talk about where it all starts — the **Azure Portal**. +Think of the portal as your *home base in Azure*: it’s a powerful, web-based dashboard where you can create, monitor, and manage everything you build in the cloud. + +From here, you can spin up virtual machines, configure security, manage networks, and track costs — all in one place. This is the same interface that professional cloud engineers use every day. + +### **What You Can Do in the Portal** +- Create and manage resources (virtual machines, databases, and storage accounts). +- Configure networking and security to control access. +- Monitor usage, costs, and performance. + +### **Real-World Use Cases** +- **Developers:** Deploy and scale applications. +- **IT Teams:** Manage identity and access. +- **Businesses:** Maintain reliability, security, and compliance. + +> ![Azure Portal Home/Dashboard](lessons/08_cloud_intro/resources/azure_home.jpg "Azure Portal Home/Dashboard") + +🔗 [Learn more: Azure Portal Overview](https://learn.microsoft.com/en-us/azure/azure-portal/azure-portal-overview) + +--- + +## **1.2 Logging In and Exploring the Portal** + +Welcome to Azure! 🎉 +This is your first step into a professional-grade cloud environment. Using your **CTD Azure account**, you’ll log into the same kind of platform that powers applications used by millions worldwide. + +### **Steps** +1. Go to [https://portal.azure.com](https://portal.azure.com). +2. Sign in with the **CTD Azure account** you’ve been provided (check your email for credentials). +3. Once logged in, take a minute to explore the interface. Don’t worry — we’ll go through everything together. + +### **Explore These Key Areas** +- **Search Bar:** Instantly find any Azure service. +- **Create a Resource (+):** Add new virtual machines, databases, or storage accounts. +- **Dashboard:** Your customizable home screen. +- **Cloud Shell Icon (>_):** Opens a terminal in the cloud — we’ll use this soon! + +**Activity:** Try searching for *“Virtual Machine.”* You don’t need to create anything yet — just notice how easy it is to access services. + +>**Tip:** The search bar is one of the most powerful tools in Azure. Use it often to find what you need quickly! + +--- + +## **2.1 Getting Started with Cloud Shell** + +Let’s spin up your very first **command-line in the cloud!** +Azure Cloud Shell is a browser-based terminal that runs a small virtual machine behind the scenes — giving you a Linux environment right in your browser. + +### **Steps** +1. Click the **Cloud Shell icon (>_)** in the top menu of the Azure Portal. +2. Choose **Bash** (the Linux-style shell). +3. If prompted, **create storage** — this will save your files for next time. +4. Select your subscription if asked. + +### **Test the Environment** +Run a couple of commands to confirm everything is working: +```bash +az --version +python3 --version +``` +If both return version numbers, congratulations! 🎉 You now have a live cloud terminal that runs both Azure CLI and Python. + +> **Tip:** Cloud Shell automatically authenticates you — no need to log in again! + + +--- + +## **2.2 Exploring the Cloud Shell Filesystem** + +Just like you use folders and files on your own computer, you can explore and organize files in Cloud Shell. The difference? These files live in Azure and can be accessed from anywhere in the world. + +### **Try These Commands** +```bash +pwd # show current directory +ls -la # list files +mkdir azure-lab # create a folder +cd azure-lab +echo "Welcome to Azure Cloud Shell" > hello.txt +cat hello.txt +``` + +**Outcome:** You can now navigate and manage files within a cloud-based filesystem. +Notice how familiar this feels — it’s just like using your own terminal, but this one lives in the cloud! + +> ![Cloud Shell terminal](lessons/08_cloud_intro/resources/shell_file_list.png "Cloud Shell terminal") + +--- + +## **2.3 Running Azure CLI Commands** + +The Azure Command-Line Interface (`az`) is a powerful tool that lets you create, view, and manage resources directly from your terminal. + +> ⚠️ **Warning:** The CLI gives you *direct access* to Azure resources. With one command, you can create or delete entire systems — so always double-check what you’re running. +> For now, we’ll stick with **safe, read-only commands**. + +### **Try These Commands** +```bash +az account show --output table # show your current subscription +az account list --output table # list all accessible subscriptions +az group list --output table # list existing resource groups +az vm --help # explore VM options +``` + +🔗 [Learn more: Azure CLI Overview](https://learn.microsoft.com/en-us/cli/azure/get-started-with-azure-cli) + +**Outcome:** You’ve learned how to interact with Azure programmatically — the same way professional engineers automate their tasks! + +--- + +## **2.4 Using the Cloud Shell Editor** + +The Cloud Shell comes with a **built-in code editor** that feels like a lightweight version of VS Code right inside your browser. You can write and run scripts directly in the cloud — no setup required! + +> ![Cloud Shell Editpr](lessons/08_cloud_intro/resources/shell_editor.png "Cloud Shell Editor") +### **Steps** +1. Open the editor: + ```bash + code . + ``` +2. Create a new Python file: + ```bash + touch hello_azure.py + code hello_azure.py + ``` +3. Paste this code into the editor: +```python +# hello_azure.py +import os, sys, platform + +print("Hello from Azure Cloud Shell!") +print("Python version:", sys.version.split()[0]) +print("Platform:", platform.platform()) +print("Current directory:", os.getcwd()) +print("Files:", os.listdir(".")) +``` +4. Save your work (**Ctrl+S** on Windows or **Cmd+S** on Mac). +5. Run your script: + ```bash + python hello_azure.py + ``` + +**Outcome:** You’ve written and executed your first Python script *in the cloud*! + +--- + +## **3. Executing Python in the Cloud** +Running Python in Cloud Shell lets you process data, test APIs, or automate workflows without installing anything locally. You can write code from anywhere — even on a Chromebook or tablet — and it’ll just work. + +> **Tip:** Python and Azure CLI can be combined for automation, reporting, and managing cloud resources at scale. + +--- + +## **4. Other Ways to Work with Azure** + +Once you’re comfortable in the Portal and Cloud Shell, there are **other environments** you can explore: +- **VS Code Desktop:** Connect directly to Azure, manage resources, and deploy code. +- **VS Code Web:** A browser-based IDE (still a bit buggy but fun to explore). +- **Cloud-Based IDEs:** Platforms like GitHub Codespaces or Azure Lab Services allow fully online development. + +These are advanced tools, but they show just how flexible cloud development can be — you’re no longer limited by your local machine. + +--- + +## **5. Wrap-Up & Next Steps** + +Congratulations! 🎉 You just completed your first hands-on Azure lab. + +You’ve learned how to: +- Log into Azure using a CTD account. +- Explore the Portal and Cloud Shell. +- Run commands and scripts directly in the cloud. +- Write and execute a Python script from the Cloud Shell editor. + +### **Next Steps** +- Try creating your first **Resource Group** using Azure CLI. +- Compare the **Portal GUI vs. CLI** experience. +- Explore **VS Code integration** for future lessons. + +> You’ve just taken your first real step into cloud computing — and this is only the beginning! + +--- diff --git a/lessons/08_cloud_intro/Week2_README.md b/lessons/08_cloud_intro/Week2_README.md new file mode 100644 index 0000000..0e00acd --- /dev/null +++ b/lessons/08_cloud_intro/Week2_README.md @@ -0,0 +1,186 @@ +# **Week_2 — Hands-On with Microsoft Azure** + +## **Lesson Overview** +**Learning objective:** In this lesson, students will gain their first hands-on experience with Microsoft Azure. They will log into the Azure Portal, explore its main features, launch Cloud Shell, run filesystem and Azure CLI commands, and write a Python script directly in the cloud. By the end of this lesson, students will feel comfortable navigating Azure and executing basic tasks using both the portal and CLI. + +### **Topics:** +1. Introduction to the Azure Portal +2. Logging in & Exploring the Portal +3. Getting Started with Cloud Shell +4. Exploring the Cloud Shell Filesystem +5. Running Azure CLI Commands +6. Working with the Cloud Shell Editor +7. Executing Python in the Cloud +8. Connecting with VS Code Desktop (Optional) +9. Wrap-Up & Next Steps + +--- + +## **2.1 Introduction to the Azure Portal** + +### **Overview** +The Azure Portal is a **web-based dashboard** for managing Azure services. It enables you to: +- Create and monitor resources (VMs, storage, databases). +- Configure networking and security. +- Manage subscriptions and billing. + +### **Real-World Use Cases:** +- **Developers:** Deploy and scale applications. +- **IT Teams:** Manage identity, access, and security. +- **Businesses:** Ensure reliability, compliance, and scalability. + +🔗 [Azure Portal Overview](https://learn.microsoft.com/en-us/azure/azure-portal/azure-portal-overview) + +--- + +## **2.2 Logging in & Exploring the Portal** + +### **Steps:** +1. Open [https://portal.azure.com](https://portal.azure.com). +2. Sign in with your Microsoft account (work, school, or sandbox). +3. Explore the key UI areas: + - **Search bar** — Quickly find any service. + - **Create a resource** — Add new Azure resources. + - **Dashboard** — Customizable home page. + - **Cloud Shell icon** — Access Cloud Shell from the top menu. + +**Activity:** Search for *“Virtual Machine”* and open the service page. + +--- + +## **2.3 Getting Started with Cloud Shell** + +### **Overview** +Azure Cloud Shell provides a browser-based command-line interface. + +### **Steps:** +1. Click the **Cloud Shell icon** in the portal header. +2. Select **Bash** when prompted. +3. Accept the prompt to create storage (saves your files) or continue without storage. +4. Select your subscription from the drop-down. + +### **Test the Environment:** +```bash +az --version +python3 --version +``` + +--- + +## **2.4 Exploring the Cloud Shell Filesystem** + +### **Example Commands:** +```bash +pwd # show current directory +ls -la # list files +mkdir azure-lab # create a folder +cd azure-lab +echo "Welcome to Azure Cloud Shell" > hello.txt +cat hello.txt +``` + +**Outcome:** Students will be comfortable navigating and managing files within the cloud-based filesystem. + +--- + +## **2.5 Running Azure CLI Commands** + +### **Overview** +The **Azure CLI** (`az`) is a command-line tool to manage Azure resources programmatically. + +### **Example Commands:** +```bash +az account show --output table # show current subscription +az account list --output table # list all subscriptions +az group list --output table # list existing resource groups +az vm --help # get VM-related help +``` + +🔗 [Azure CLI Documentation](https://learn.microsoft.com/en-us/cli/azure/get-started-with-azure-cli?view=azure-cli-latest) + +--- + +## **2.6 Working with the Cloud Shell Editor** + +### **Steps:** +1. Open the editor in Cloud Shell: + ```bash + code . + ``` + *(Confirm the prompt to switch to classic shell if asked.)* + +2. Create a new Python file: + ```bash + touch hello_azure.py + code . + ``` + +3. Paste the script below into `hello_azure.py`: + ```python + # hello_azure.py + import os, sys, platform + + print("Hello from Azure Cloud Shell!") + print("Python version:", sys.version.split()[0]) + print("Platform:", platform.platform()) + print("Current directory:", os.getcwd()) + print("Files:", os.listdir(".")) + ``` + +4. Save the file. + +--- + +## **2.7 Executing Python in the Cloud** + +### **Run the Script:** +```bash +python hello_azure.py +``` + +**Outcome:** The script prints system details and file information from within the Azure Cloud Shell environment. + +--- + +## **2.8 Connecting with VS Code Desktop (Optional)** + +### **Steps:** +1. Install **Visual Studio Code**. +2. Add the **Azure Tools extension**. +3. Sign in with your Azure account. +4. Open Cloud Shell directly from VS Code’s terminal menu. + +--- + +## **2.9 Wrap-Up & Next Steps** + +### **You just accomplished:** +- Logged into the Azure Portal. +- Explored the Portal UI. +- Used Cloud Shell to run filesystem and Azure CLI commands. +- Created and ran a Python script in the cloud. + +### **Next Steps:** +- Deploy a Virtual Machine. +- Compare working with the **Portal GUI vs. Azure CLI**. +- Keep practicing — Azure skills grow with hands-on experience! + +--- + +## **Summary** + +In this lesson, you learned: +1. How to log in and explore the Azure Portal. +2. How to launch and use Cloud Shell. +3. How to run filesystem and Azure CLI commands. +4. How to create and run a Python script in the cloud. +5. (Optional) How to connect Azure with VS Code. + +--- + +### **Additional Resources** + +1. [Azure Getting Started](https://azure.microsoft.com/en-us/get-started) +2. [Azure Portal Overview](https://learn.microsoft.com/en-us/azure/azure-portal/azure-portal-overview) +2. [Azure CLI Documentation](https://learn.microsoft.com/en-us/cli/azure/get-started-with-azure-cli?view=azure-cli-latest) +3. [VS Code + Azure Integration](https://code.visualstudio.com/docs/azure/extensions) \ No newline at end of file diff --git a/lessons/08_cloud_intro/persistent_shell.md b/lessons/08_cloud_intro/persistent_shell.md new file mode 100644 index 0000000..eea422a --- /dev/null +++ b/lessons/08_cloud_intro/persistent_shell.md @@ -0,0 +1,137 @@ +# Setting Up Azure Cloud Shell with Storage +By the end of this activity, you will have a *persistent* Azure Cloud Shell workspace that saves files and SSH keys between sessions. This gives you a safe, browser-based development environment for all cloud work in this course. + +By default, the Cloud Shell runs in a *temporary container*. When you close your browser, everything disappears: files, API keys, scripts. To fix that, we'll connect it to a small piece of *persistent storage* called a *file share*. You'll also create an *SSH key pair*, creating a secure way to access online resources in future lessons, without the need for passwords. + +Even this simple task will help us explore the Azure Portal, Cloud Shell, and explore some useful concepts that we will see in more detail in future weeks. + +## 1. Create a Resource Group +All Azure resources — such as storage accounts and virtual machines — must belong to a *resource group*. A resource group is a container that keeps related resources together (e.g., all the compute and memory resources that go with one project). + +For more on [resource groups](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/overview#resource-groups) + +Here, we'll create a resource group to contain resources for storage. +Note: Resource groups will already be created for you. + +1. Sign in at https://portal.azure.com. +2. In the left menu choose **Resource groups + Create**. +3. Fill in: + - **Subscription:** your active CTD subscription + - **Resource group name:** `cloudshell-rg` + - **Region:** your nearest region (for instance, East US) +4. Click **Review + create Create**. + +## 2. Set up persistent storage +In this section, we're setting up the persistent storage that Cloud Shell needs to save files between sessions. We won't explore how cloud memory and storage work in detail until Week 3, so don't worry if some of these details feel abstract right now. + +### Create a Storage Account +The storage account is like your own private workspace in your Azure account where different types of data can be stored. It's where you set the configuration parameters for storage. + +1. In the portal, go to **Storage accounts + Create**. +2. Fill in: + - **Resource group:** `cloudshell-rg` + - **Storage account name:** `cloudstore` (e.g., `cloudstoreeric`) + - **Region:** pick the same region as you did for your resource group + - **Storage type:** *Azure files* + - **Performance:** *Standard* + - **Redundancy:** *Locally redundant storage (LRS)* +3. Click **Review + create** -> **Create**. After you click **Create**, you'll see a short progress message at the top of the screen as it creates the Storage Account. + + +### Create the File Share +Now that you have a storage account, we will create a *file share*, which is a specific folder inside the storage account. This is the actual directory that you will be able to access. + +We will name the drive `clouddrive`, which is special: Cloud Shell automatically looks for a directory with that name when setting up your persistent storage and mounts it each time you start Cloud Shell. + +1. After creating the storage account in the previous step, you can open it by going to Home → Storage accounts → [your storage account name] in the Azure Portal. +2. In the left panel in the Portal, select **Data storage -> File shares -> + File share** to create a file share. +3. Name it **`clouddrive`** (as mentioned, Cloud Shell expects that). +4. Click **Create**. +5. Open **clouddrive** -> click **edit quota** and se to **5 GB.** +### Mount the File Share in Cloud Shell +We are now ready to move past emphemeral Cloud Shell! + +1. In the portal top bar, click the **Cloud Shell ( >_ )** icon. +2. Choose **Bash** when prompted. +3. You'll see a setup panel titled **Mount storage account**. +4. Fill in: + - **Subscription:** your CTD subscription + - **Resource group:** `cloudshell-rg` (you created this above) + - **Storage account:** `cloudstore` + - **File share:** `clouddrive` +5. Click **Apply**. + +Azure will display: +> "Your Cloud Shell is now backed by storage account 'cloudstore'." + +This means persistence is active! Congrats! You can verify persistence inside the cloud shell with: + +```bash +ls ~/clouddrive +echo "hello cloud shell" > ~/clouddrive/test.txt +ls ~/clouddrive +``` + +Then close Cloud Shell and reopen it (click the `>_` icon again). +Run `ls ~/clouddrive` once more you should still see `test.txt`. + +In general, each time you start the Cloud Shell, the `clouddrive/` directory should be in your home directory. + +## 4. SSH Keys +We have one more important step, which is one of the main points for doing all this work: creating and storing SSH keys. In future weeks, when you connect to a cloud computer (a *virtual machine*), Azure will need to verify who you are. Instead of a password, you'll use an **SSH key pair**. + +With a persistent storage mechanism in place in our shell, we will be able to store SSH keys across sessions! + +### What is SSH? +SSH (Secure Shell) is one of the core technologies that makes the modern internet safe. It provides an encrypted way for computers to talk over insecure networks, protecting everything you send — commands, files, credentials — from being seen or altered. SSH replaced older, insecure login methods like telnet by adding encryption and strong cryptographic identity checks. Today it underlies secure connections to millions of servers, cloud platforms, and developer tools such as GitHub. + +SSH uses a key pair -- one public and one private -- to prove identity without ever sending a password. Your private key stays on your computer (never share it). Your public key is shared with the systems you want to access. When you connect, SSH verifies that the two match, creating a secure handshake that confirms who you are. In this course, we’ll use SSH keys to authenticate when setting up virtual machines, but the same mechanism also powers secure Git operations and many other online services. + +More on [SSH](https://www.cloudflare.com/learning/access-management/what-is-ssh/) + +### Generate SSH Keys +Let's create our SSH keys using the Cloud Shell. As discussed above, you'll actually make two files that work together: a private key and a public key. The private key (`id_rsa`) will stay on your Cloud Shell and should never be shared. The public key (`id_rsa.pub`) is safe to share; Azure will copy it into any virtual machines or services that need to recognize you. + +We will store these keys in the default SSH folder at `~/.ssh/`, which is where Azure CLI automatically looks when you try to create new resources using commands like `az create vm`. + +In your cloud shell, first create the directory for the keys and then generate the keys using the `ssh-keygen` command (press Enter to accept defaults): + +```bash +mkdir -p ~/.ssh # create .ssh directory in home +ssh-keygen -t rsa -b 4096 +``` + +You will be asked where to save, and if you want to create a passphrase, just press Enter to accept the defaults. + +When you run this command, it automatically saves your new keys in the default SSH folder (~/.ssh/). That is, if that folder already exists from the previous step, the keys will be created there automatically, with the private key named `id_rsa` and the public key named `id_rsa.pub`. + +Also, once your key is created, you'll see a block of random characters called randomart. This is just a visual fingerprint for your key -- it's normal and nothing you need to worry about. You can think of it as a 1990s-era NFT associated with your SSH key. :smile: + +Go ahead and verify that you created the keys: + +```bash +ls ~/.ssh +``` + +Because your Cloud Shell now has persistence, these keys will remain available in every session. + + +**Question** Will this disappear because we haven't placed `.ssh` in `clouddrive/`? +**Answer**: While indeed, we only set up your `clouddrive/` folder to persist between sessions, Azure makes an exception for SSH keys. Because the `.ssh` folder is so important, the Cloud Shell automatically detects it and links it to your persistent storage. This ensures your keys are available every time you return to the Cloud Shell! + +### Back Up Your Keys Locally +Even though Cloud Shell keeps your keys safe between sessions, it's still a good idea to download a copy to your local computer. If the cloud storage link ever breaks or you create other resources that use your key, having a backup will save you time later. + +1. In Cloud Shell, click **manage files** select **Download**. +2. Enter path `/home//.ssh/`. +3. Download both: + - `id_rsa` keep private and secure + - `id_rsa.pub` safe to share or view + +Store them on your computer in a folder such as +`C:\Users\\.ssh\` (on Windows) or `~/.ssh/` (on macOS/Linux). + +## 5. Summing up +Congratulations! You've just set up your persistent Azure Cloud Shell workspace and created your first SSH key pair. That means you now have a secure, browser-based command line that remembers your files and credentials between sessions. This setup will make all your future cloud work easier — especially when you start creating virtual machines and deploying applications in the next lessons. + +add cleanup step \ No newline at end of file diff --git a/lessons/08_cloud_intro/resources/azure_home.jpg b/lessons/08_cloud_intro/resources/azure_home.jpg new file mode 100644 index 0000000..264148f Binary files /dev/null and b/lessons/08_cloud_intro/resources/azure_home.jpg differ diff --git a/lessons/08_cloud_intro/resources/shell_editor.png b/lessons/08_cloud_intro/resources/shell_editor.png new file mode 100644 index 0000000..caf8cd6 Binary files /dev/null and b/lessons/08_cloud_intro/resources/shell_editor.png differ diff --git a/lessons/08_cloud_intro/resources/shell_file_list.png b/lessons/08_cloud_intro/resources/shell_file_list.png new file mode 100644 index 0000000..a3922b3 Binary files /dev/null and b/lessons/08_cloud_intro/resources/shell_file_list.png differ