Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

New-AzADAppCredential

Creates key credentials or password credentials for an application.

Syntax

ApplicationObjectIdWithPasswordParameterSet (Default)

New-AzADAppCredential
 -ObjectId <String>
 [-StartDate <DateTime>]
 [-EndDate <DateTime>]
 [-CustomKeyIdentifier <String>]
 [-DefaultProfile <PSObject>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

ApplicationObjectIdWithCertValueParameterSet

New-AzADAppCredential
 -ObjectId <String>
 -CertValue <String>
 [-StartDate <DateTime>]
 [-EndDate <DateTime>]
 [-CustomKeyIdentifier <String>]
 [-DefaultProfile <PSObject>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

ApplicationObjectIdWithKeyCredentialParameterSet

New-AzADAppCredential
 -ObjectId <String>
 -KeyCredentials <MicrosoftGraphKeyCredential[]>
 [-CustomKeyIdentifier <String>]
 [-DefaultProfile <PSObject>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

ApplicationObjectIdWithPasswordCredentialParameterSet

New-AzADAppCredential
 -ObjectId <String>
 -PasswordCredentials <MicrosoftGraphPasswordCredential[]>
 [-CustomKeyIdentifier <String>]
 [-DefaultProfile <PSObject>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

ApplicationObjectWithPasswordParameterSet

New-AzADAppCredential
 -ApplicationObject <IMicrosoftGraphApplication>
 [-StartDate <DateTime>]
 [-EndDate <DateTime>]
 [-CustomKeyIdentifier <String>]
 [-DefaultProfile <PSObject>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

ApplicationObjectWithCertValueParameterSet

New-AzADAppCredential
 -CertValue <String>
 -ApplicationObject <IMicrosoftGraphApplication>
 [-StartDate <DateTime>]
 [-EndDate <DateTime>]
 [-CustomKeyIdentifier <String>]
 [-DefaultProfile <PSObject>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

DisplayNameWithPasswordParameterSet

New-AzADAppCredential
 -DisplayName <String>
 [-StartDate <DateTime>]
 [-EndDate <DateTime>]
 [-CustomKeyIdentifier <String>]
 [-DefaultProfile <PSObject>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

DisplayNameWithCertValueParameterSet

New-AzADAppCredential
 -CertValue <String>
 -DisplayName <String>
 [-StartDate <DateTime>]
 [-EndDate <DateTime>]
 [-CustomKeyIdentifier <String>]
 [-DefaultProfile <PSObject>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

ApplicationIdWithCertValueParameterSet

New-AzADAppCredential
 -CertValue <String>
 -ApplicationId <Guid>
 [-StartDate <DateTime>]
 [-EndDate <DateTime>]
 [-CustomKeyIdentifier <String>]
 [-DefaultProfile <PSObject>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

ApplicationIdWithPasswordParameterSet

New-AzADAppCredential
 -ApplicationId <Guid>
 [-StartDate <DateTime>]
 [-EndDate <DateTime>]
 [-CustomKeyIdentifier <String>]
 [-DefaultProfile <PSObject>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

ApplicationObjectWithPasswordCredentialParameterSet

New-AzADAppCredential
 -PasswordCredentials <MicrosoftGraphPasswordCredential[]>
 -ApplicationObject <IMicrosoftGraphApplication>
 [-CustomKeyIdentifier <String>]
 [-DefaultProfile <PSObject>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

DisplayNameWithPasswordCredentialParameterSet

New-AzADAppCredential
 -PasswordCredentials <MicrosoftGraphPasswordCredential[]>
 -DisplayName <String>
 [-CustomKeyIdentifier <String>]
 [-DefaultProfile <PSObject>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

ApplicationIdWithPasswordCredentialParameterSet

New-AzADAppCredential
 -PasswordCredentials <MicrosoftGraphPasswordCredential[]>
 -ApplicationId <Guid>
 [-CustomKeyIdentifier <String>]
 [-DefaultProfile <PSObject>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

ApplicationObjectWithKeyCredentialParameterSet

New-AzADAppCredential
 -KeyCredentials <MicrosoftGraphKeyCredential[]>
 -ApplicationObject <IMicrosoftGraphApplication>
 [-CustomKeyIdentifier <String>]
 [-DefaultProfile <PSObject>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

DisplayNameWithKeyCredentialParameterSet

New-AzADAppCredential
 -KeyCredentials <MicrosoftGraphKeyCredential[]>
 -DisplayName <String>
 [-CustomKeyIdentifier <String>]
 [-DefaultProfile <PSObject>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

ApplicationIdWithKeyCredentialParameterSet

New-AzADAppCredential
 -KeyCredentials <MicrosoftGraphKeyCredential[]>
 -ApplicationId <Guid>
 [-CustomKeyIdentifier <String>]
 [-DefaultProfile <PSObject>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

Description

Creates key credentials or password credentials for an application.

Examples

Example 1: Create key credentials for application

# 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

Create key credentials for application with object Id $Id

Example 2: Create password credentials for application

# 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

Create password credentials for application

Parameters

-ApplicationId

The application Id.

Parameter properties

Type:Guid
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-ApplicationObject

The application object, could be used as pipeline input.

Parameter properties

Type:IMicrosoftGraphApplication
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-CertValue

The value of the 'asymmetric' credential type. It represents the base 64 encoded certificate.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

-CustomKeyIdentifier

Custom Key Identifier. The format should be base64: $Bytes=[System.Text.Encoding]::Unicode.GetBytes($key);$key=[Convert]::ToBase64String($Bytes)

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

Type:PSObject
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

-DisplayName

The display name of application.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-EndDate

The effective end date of the credential usage. The default end date value is one year from today. For an 'asymmetric' type credential, this must be set to on or before the date that the X509 certificate is valid.

Parameter properties

Type:DateTime
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-KeyCredentials

key credentials associated with the application.

Parameter properties

Type:

MicrosoftGraphKeyCredential[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-ObjectId

The object Id of application.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Id

Parameter sets

-PasswordCredentials

Password credentials associated with the application.

Parameter properties

Type:

MicrosoftGraphPasswordCredential[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-StartDate

The effective start date of the credential usage. The default start date value is today. For an 'asymmetric' type credential, this must be set to on or after the date that the X509 certificate is valid from.

Parameter properties

Type:DateTime
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

IMicrosoftGraphApplication

Outputs

IMicrosoftGraphKeyCredential

IMicrosoftGraphPasswordCredential


Feedback

Was this page helpful?