Skip to content

Commit 95bf60a

Browse files
Merge pull request #214208 from rwike77/appid
ApplicationId -> AppId
2 parents efe36e6 + 588d8e8 commit 95bf60a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

articles/active-directory/develop/howto-authenticate-service-principal-powershell.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.subservice: develop
1010
ms.custom: aaddev, devx-track-azurepowershell
1111
ms.topic: how-to
1212
ms.tgt_pltfrm: multiple
13-
ms.date: 02/22/2021
13+
ms.date: 10/11/2021
1414
ms.author: ryanwi
1515
ms.reviewer: tomfitz
1616
---
@@ -60,7 +60,7 @@ $sp = New-AzADServicePrincipal -DisplayName exampleapp `
6060
-EndDate $cert.NotAfter `
6161
-StartDate $cert.NotBefore
6262
Sleep 20
63-
New-AzRoleAssignment -RoleDefinitionName Reader -ServicePrincipalName $sp.ApplicationId
63+
New-AzRoleAssignment -RoleDefinitionName Reader -ServicePrincipalName $sp.AppId
6464
```
6565

6666
The example sleeps for 20 seconds to allow some time for the new service principal to propagate throughout Azure AD. If your script doesn't wait long enough, you'll see an error stating: "Principal {ID} does not exist in the directory {DIR-ID}." To resolve this error, wait a moment then run the **New-AzRoleAssignment** command again.
@@ -90,7 +90,7 @@ Whenever you sign in as a service principal, provide the tenant ID of the direct
9090

9191
```powershell
9292
$TenantId = (Get-AzSubscription -SubscriptionName "Contoso Default").TenantId
93-
$ApplicationId = (Get-AzADApplication -DisplayNameStartWith exampleapp).ApplicationId
93+
$ApplicationId = (Get-AzADApplication -DisplayNameStartWith exampleapp).AppId
9494
9595
$Thumbprint = (Get-ChildItem cert:\CurrentUser\My\ | Where-Object {$_.Subject -eq "CN=exampleappScriptCert" }).Thumbprint
9696
Connect-AzAccount -ServicePrincipal `
@@ -137,7 +137,7 @@ Param (
137137
{
138138
# Sleep here for a few seconds to allow the service principal application to become active (should only take a couple of seconds normally)
139139
Sleep 15
140-
New-AzRoleAssignment -RoleDefinitionName Reader -ServicePrincipalName $ServicePrincipal.ApplicationId | Write-Verbose -ErrorAction SilentlyContinue
140+
New-AzRoleAssignment -RoleDefinitionName Reader -ServicePrincipalName $ServicePrincipal.AppId | Write-Verbose -ErrorAction SilentlyContinue
141141
$NewRole = Get-AzRoleAssignment -ObjectId $ServicePrincipal.Id -ErrorAction SilentlyContinue
142142
$Retries++;
143143
}
@@ -185,7 +185,7 @@ The application ID and tenant ID aren't sensitive, so you can embed them directl
185185
If you need to retrieve the application ID, use:
186186

187187
```powershell
188-
(Get-AzADApplication -DisplayNameStartWith {display-name}).ApplicationId
188+
(Get-AzADApplication -DisplayNameStartWith {display-name}).AppId
189189
```
190190

191191
## Change credentials

0 commit comments

Comments
 (0)