Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update New-AzADAppCredential.md #20317

Merged
merged 3 commits into from
Nov 30, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions src/Resources/Resources/help/New-AzADAppCredential.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,28 +122,30 @@ Creates key credentials or password credentials for an application.

## EXAMPLES

### Example 1: Create key credentials for application
### Example 1: Create key credentials for an application

```powershell
# ObjectId is the string representation of a GUID for directory object, application, in Azure AD.
$Id = "00000000-0000-0000-0000-000000000000"
# $cert is Base64 encoded content of certificate
$credential = New-Object -TypeName "Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.MicrosoftGraphKeyCredential" `
-Property @{'Key' = $cert;
'Usage' = 'Verify';
'Type' = 'AsymmetricX509Cert'
}
New-AzADAppCredential -ObjectId $Id -KeyCredentials $credential
# $ObjectId should be the the 'Object ID' GUID associated with the Azure app registration.
# $CertificateThumbprint should be the thumbprint of the certificate.
# $Cert is the base64 encoded content of the certificate.
$ObjectId = "00000000-0000-0000-0000-000000000000"
$Credential = New-Object -TypeName `
"Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.MicrosoftGraphKeyCredential" `
-Property @{'Key' = $Cert;
'Usage' = 'Verify';
'Type' = 'AsymmetricX509Cert'
}
New-AzADAppCredential -ObjectId $ObjectId -KeyCredentials $Credential -CustomKeyIdentifier $CertificateThumbprint
```

Create key credentials for application with object Id $Id
### Example 2: Create password credentials for an application

### Example 2: Create password credentials for application
```powershell
# ApplicationId is AppId of Application object which is different from directory id in Azure AD.
Get-AzADApplication -ApplicationId $appId | New-AzADAppCredential -StartDate $startDate -EndDate $endDate
# $ApplicationId` should be the the 'Application ID' GUID associated with the Azure app registration.
$ApplicationId = "00000000-0000-0000-0000-000000000000"
Get-AzADApplication -ApplicationId $ApplicationId | New-AzADAppCredential -StartDate $startDate -EndDate $endDate
```

Create password credentials for application

## PARAMETERS

Expand Down