Skip to content

Commit c910e44

Browse files
committed
Add instructions for authenticating in multi-tenant scenarios
1 parent 1e21f56 commit c910e44

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ Import-Module Az.Resources
110110
Connect-AzAccount -UseDeviceAuthentication
111111
```
112112

113+
If you have multiple tenants, you can use the following command instead to login to the correct tenant:
114+
115+
```pwsh
116+
Connect-AzAccount -UseDeviceAuthentication -TenantId <tenant-id>
117+
```
118+
113119
Set the subscription to the one you want to use (you can use [Get-AzSubscription](https://learn.microsoft.com/powershell/module/az.accounts/get-azsubscription?view=azps-11.3.0) to list available subscriptions):
114120

115121
```pwsh
@@ -126,6 +132,12 @@ Use the next command to login with the Azure Dev CLI (AZD) tool:
126132
azd auth login --use-device-code
127133
```
128134

135+
If you have multiple tenants, you can use the following command instead to log into the correct tenant:
136+
137+
```pwsh
138+
azd auth login --use-device-code --tenant-id <tenant-id>
139+
```
140+
129141
### 4. Create a new environment
130142

131143
Next we provide the AZD tool with variables that it uses to create the deployment. The first thing we initialize is the AZD environment with a name.

prod-deployment.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ The following detailed deployment steps assume you are using a Dev Container ins
4242
```pwsh
4343
Connect-AzAccount -UseDeviceAuthentication
4444
```
45+
If you have multiple tenants, you can use the following command instead to login to the correct tenant:
46+
47+
```pwsh
48+
Connect-AzAccount -UseDeviceAuthentication -TenantId <tenant-id>
49+
```
4550

4651
1. Set the subscription to the one you want to use (you can use [Get-AzSubscription](https://learn.microsoft.com/powershell/module/az.accounts/get-azsubscription?view=azps-11.3.0) to list available subscriptions):
4752

@@ -60,6 +65,11 @@ The following detailed deployment steps assume you are using a Dev Container ins
6065
azd auth login --use-device-code
6166
```
6267

68+
If you have multiple tenants, you can use the following command instead to log into the correct tenant:
69+
70+
```pwsh
71+
azd auth login --use-device-code --tenant-id <tenant-id>
72+
```
6373

6474
### 2. Provision the app
6575

@@ -117,6 +127,12 @@ The following detailed deployment steps assume you are using a Dev Container ins
117127
```pwsh
118128
az login --use-device-code
119129
```
130+
131+
If you have multiple tenants, you can use the following command instead to log into the correct tenant:
132+
133+
```pwsh
134+
az login --use-device-code --tenant <tenant-id>
135+
```
120136

121137
```pwsh
122138
$AZURE_SUBSCRIPTION_ID = ((azd env get-values --output json | ConvertFrom-Json).AZURE_SUBSCRIPTION_ID)
@@ -207,6 +223,7 @@ The following detailed deployment steps assume you are using a Dev Container ins
207223
exit # exit the ssh connection
208224
ssh -F ./ssh-config 127.0.0.1 -p 50022
209225
pwsh
226+
cd web-app-pattern
210227
```
211228
212229
1. [Sign in to Azure PowerShell interactively](https://learn.microsoft.com/powershell/azure/authenticate-interactive):
@@ -215,6 +232,12 @@ The following detailed deployment steps assume you are using a Dev Container ins
215232
Connect-AzAccount -UseDeviceAuthentication
216233
```
217234
235+
If you have multiple tenants, you can use the following command instead to login to the correct tenant:
236+
237+
```pwsh
238+
Connect-AzAccount -UseDeviceAuthentication -TenantId <tenant-id>
239+
```
240+
218241
```pwsh
219242
Set-AzContext -SubscriptionId ((azd env get-values --output json | ConvertFrom-Json).AZURE_SUBSCRIPTION_ID)
220243
```
@@ -225,6 +248,12 @@ The following detailed deployment steps assume you are using a Dev Container ins
225248
azd auth login --use-device-code
226249
```
227250
251+
If you have multiple tenants, you can use the following command instead to log into the correct tenant:
252+
253+
```pwsh
254+
azd auth login --use-device-code --tenant-id <tenant-id>
255+
```
256+
228257
1. Deploy the application to the primary region using:
229258
230259
<!-- from PowerShell use the following command to deploy the code to the secondary region:

0 commit comments

Comments
 (0)