@@ -5,6 +5,151 @@ ms.date: 03/06/2023
5
5
ms.topic : article
6
6
tags : azure-resource-manager
7
7
title : Quickstart for Azure Cloud Shell
8
+ ---
9
+ # Quickstart for Azure Cloud Shell
10
+
11
+ This document details how to use Bash and PowerShell in Azure Cloud Shell from the
12
+ [ Azure portal] [ 03 ] .
13
+
14
+ ## Start Cloud Shell
15
+
16
+ 1 . Launch ** Cloud Shell** from the top navigation of the Azure portal.
17
+
18
+ ![ Screenshot showing how to start Azure Cloud Shell in the Azure portal.] [ 06 ]
19
+
20
+ The first time you start Cloud Shell you're prompted to create an Azure Storage account for the
21
+ Azure file share.
22
+
23
+ ![ Screenshot showing the create storage prompt.] [ 05 ]
24
+
25
+ 1 . Select the ** Subscription** used to create the storage account and file share.
26
+ 1 . Select ** Create storage** .
27
+
28
+ ### Select your shell environment
29
+
30
+ Cloud Shell allows you to select either ** Bash** or ** PowerShell** for your command-line experience.
31
+
32
+ ![ Screenshot showing the shell selector.] [ 04 ]
33
+
34
+ ### Registering your subscription with Azure Cloud Shell
35
+
36
+ Azure Cloud Shell needs access to manage resources. Access is provided through namespaces that must
37
+ be registered to your subscription. Use the following commands to register the
38
+ ** Microsoft.CloudShell** namespace in your subscription:
39
+
40
+ <!-- markdownlint-disable MD023 -->
41
+ <!-- markdownlint-disable MD024 -->
42
+ <!-- markdownlint-disable MD051 -->
43
+ #### [ Azure CLI] ( #tab/azurecli )
44
+
45
+ ``` azurecli-interactive
46
+ az account set --subscription <Subscription Name or Id>
47
+ az provider register --namespace Microsoft.CloudShell
48
+ ```
49
+
50
+ #### [ Azure PowerShell] ( #tab/powershell )
51
+
52
+ ``` azurepowershell-interactive
53
+ Select-AzSubscription -SubscriptionId <SubscriptionId>
54
+ Register-AzResourceProvider -ProviderNamespace Microsoft.CloudShell
55
+ ```
56
+ <!-- markdownlint-enable MD023 -->
57
+ <!-- markdownlint-enable MD024 -->
58
+ <!-- markdownlint-enable MD051 -->
59
+
60
+ ---
61
+
62
+ > [ !NOTE]
63
+ > You only need to register the namespace once per subscription.
64
+
65
+ ### Set your subscription
66
+
67
+ 1 . List subscriptions you have access to.
68
+
69
+ <!-- markdownlint-disable MD023 -->
70
+ <!-- markdownlint-disable MD024 -->
71
+ <!-- markdownlint-disable MD051 -->
72
+ #### [ Azure CLI] ( #tab/azurecli )
73
+
74
+ ``` azurecli-interactive
75
+ az account list
76
+ ```
77
+
78
+ #### [ Azure PowerShell] ( #tab/powershell )
79
+
80
+ ``` azurepowershell-interactive
81
+ Get-AzSubscription
82
+ ```
83
+ <!-- markdownlint-enable MD023 -->
84
+ <!-- markdownlint-enable MD024 -->
85
+ <!-- markdownlint-enable MD051 -->
86
+
87
+ ---
88
+
89
+ 1 . Set your preferred subscription:
90
+
91
+ <!-- markdownlint-disable MD023 -->
92
+ <!-- markdownlint-disable MD024 -->
93
+ <!-- markdownlint-disable MD051 -->
94
+ #### [ Azure CLI] ( #tab/azurecli )
95
+
96
+ ``` azurecli-interactive
97
+ az account set --subscription 'my-subscription-name'
98
+ ```
99
+
100
+ #### [ Azure PowerShell] ( #tab/powershell )
101
+
102
+ ``` azurepowershell-interactive
103
+ Set-AzContext -Subscription <SubscriptionId>
104
+ ```
105
+ <!-- markdownlint-enable MD023 -->
106
+ <!-- markdownlint-enable MD024 -->
107
+ <!-- markdownlint-enable MD051 -->
108
+
109
+ ---
110
+
111
+ > [ !TIP]
112
+ > Your subscription is remembered for future sessions using ` /home/<user>/.azure/azureProfile.json ` .
113
+
114
+ ### Get a list of Azure commands
115
+
116
+ <!-- markdownlint-disable MD023 -->
117
+ <!-- markdownlint-disable MD024-->
118
+ <!-- markdownlint-disable MD051 -->
119
+ #### [ Azure CLI] ( #tab/azurecli )
120
+
121
+ Run the following command to see a list of all Azure CLI commands.
122
+
123
+ ``` azurecli-interactive
124
+ az
125
+ ```
126
+
127
+ Run the following command to get a list of Azure CLI commands that apply to WebApps:
128
+
129
+ ``` azurecli-interactive
130
+ az webapp --help
131
+ ```
132
+
133
+ #### [ Azure PowerShell] ( #tab/powershell )
134
+
135
+ Run the following command to see a list of all Azure PowerShell cmdlets.
136
+
137
+ ``` azurepowershell-interactive
138
+ Get-Command -Module Az.*
139
+ ```
140
+
141
+ Under ` Azure ` drive, the ` Get-AzCommand ` lists context-specific Azure commands.
142
+
143
+ Run the following commands to get a list the Azure PowerShell commands that apply to WebApps.
144
+
145
+ ``` azurepowershell-interactive
146
+ cd 'Azure:/My Subscription/WebApps'
147
+ Get-AzCommand
148
+ ```
149
+ <!-- markdownlint-enable MD023 -->
150
+ <!-- markdownlint-enable MD024 -->
151
+ <!-- markdownlint-enable MD051 -->
152
+
8
153
---
9
154
10
155
## Next steps
0 commit comments