Introduction to Azure Cloud Shell Flashcards
Azure Cloud Shell
is a browser-accessible command-line experience for managing Azure resources. It provides the flexibility of choosing the shell experience that best suits the way you work, either Bash or PowerShell. Traditionally, to interact with Azure resources via command-line, you need to install the necessary components into your local computer (PC, Mac, Linux). With Cloud Shell, you have an authenticated, interactive shell that isn’t part of a local machine.
Access Cloud Shell
From a direct link: https://shell.azure.com
From the Azure portal
From code snippets when accessing Microsoft Learn
When you open a Cloud Shell session, a temporary host is allocated to your session. This VM is preconfigured with the latest versions of PowerShell and Bash. You can then select the command-line experience you want to use:
Cloud Shell sessions terminate after 20 minutes of inactivity. When a session terminates, files on your CloudDrive are persisted, but you need to start a new session to access the Cloud Shell environment.
Access your own scripts and files
When using Cloud Shell, you might also need to run scripts or use files for different actions. You can persist files on Cloud Shell by using the Azure CloudDrive:
After uploading files, you can interact with them as you would in a regular PowerShell or Bash session:
Now that your file resides on CloudDrive, you can close the session and open another session on a different device and still access the same file. Cloud Shell also lets you map an Azure Storage File Share, which is tied to a specific region. Access to an Azure File Share lets you work with the contents of that share through Cloud Shell.
If you need to edit scripts hosted on the CloudDrive or File Share, you can use the Cloud Shell editor. Select the curly brackets {} icon on the browser and open the file you want to edit, or use the command code and specify the filename; for example:
When should you use Azure Cloud Shell?
Open a secure command-line session from any browser-based device.
Interact with Azure resources without the need to install plug-ins or add-ons to your device.
Persist files between sessions for later use.
Use either Bash or PowerShell, whichever you prefer, to manage Azure resources.
Edit files (such as scripts) via the Cloud Shell editor.
When you shouldn’t use Azure Cloud Shell
You intend to leave a session open for more than 20 minutes for long running scripts or activities. In these cases, your session is disconnected without warning, and the current state is lost.
You need admin permissions, such as sudo access, from within the Azure CLI or PowerShell environment.
You need to install tools that aren’t supported in the limited Cloud Shell environment, but instead require an environment such as a custom virtual machine or container.
You need storage from different regions. You might need to back up and synchronize this content since only one region can have the storage allocated to Azure Cloud Shell.
You need to open multiple sessions at the same time. Azure Cloud Shell allows only one instance at time and isn’t suitable for concurrent work across multiple subscriptions or tenants.