Skip to content

Commit 1c0889b

Browse files
authored
Merge pull request Azure#230 from scottagit/patch-1
Update Connect-AzureAD.md
2 parents 911d034 + 80759d1 commit 1c0889b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

azureadps-2.0/AzureAD/Connect-AzureAD.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,20 @@ Connect-AzureAD -TenantId $tenant.ObjectId -ApplicationId $sp.AppId -Certificat
105105

106106
This command authenticates the user to Azure Active Directory as a service principal.
107107

108+
### Example 4: Connect a session using an existing token associated with the active azure context
109+
```
110+
# login
111+
Login-AzureRmAccount
112+
# perform other Azure operations...
113+
114+
$currentAzureContext = Get-AzureRmContext
115+
$tenantId = $currentAzureContext.Tenant.Id
116+
$accountId = $currentAzureContext.Account.Id
117+
Connect-AzureAD -TenantId $tenantId -AccountId $accountId
118+
```
119+
120+
This command authenticates the user to Azure Active Directory as the user associated with the current azure context, using cached tokens as possible to avoid credential re-prompting during Connect-AzureAD.
121+
108122
## PARAMETERS
109123

110124
### -AadAccessToken

0 commit comments

Comments
 (0)