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
ApplicationIdWithCertValueParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationIdWithPasswordParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationIdWithPasswordCredentialParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationIdWithKeyCredentialParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ApplicationObject
The application object, could be used as pipeline input.
Parameter properties
Parameter sets
ApplicationObjectWithPasswordParameterSet
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationObjectWithCertValueParameterSet
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationObjectWithPasswordCredentialParameterSet
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationObjectWithKeyCredentialParameterSet
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
-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
ApplicationObjectIdWithCertValueParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationObjectWithCertValueParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
DisplayNameWithCertValueParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationIdWithCertValueParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DisplayName
The display name of application.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
DisplayNameWithPasswordParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
DisplayNameWithCertValueParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
DisplayNameWithPasswordCredentialParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
DisplayNameWithKeyCredentialParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
ApplicationObjectIdWithPasswordParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationObjectIdWithCertValueParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationObjectWithPasswordParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationObjectWithCertValueParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
DisplayNameWithPasswordParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
DisplayNameWithCertValueParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationIdWithCertValueParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationIdWithPasswordParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-KeyCredentials
key credentials associated with the application.
Parameter properties
Parameter sets
ApplicationObjectIdWithKeyCredentialParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationObjectWithKeyCredentialParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
DisplayNameWithKeyCredentialParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationIdWithKeyCredentialParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ObjectId
The object Id of application.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: Id
Parameter sets
ApplicationObjectIdWithPasswordParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationObjectIdWithCertValueParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationObjectIdWithKeyCredentialParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationObjectIdWithPasswordCredentialParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-PasswordCredentials
Password credentials associated with the application.
Parameter properties
Parameter sets
ApplicationObjectIdWithPasswordCredentialParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationObjectWithPasswordCredentialParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
DisplayNameWithPasswordCredentialParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationIdWithPasswordCredentialParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
ApplicationObjectIdWithPasswordParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationObjectIdWithCertValueParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationObjectWithPasswordParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationObjectWithCertValueParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
DisplayNameWithPasswordParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
DisplayNameWithCertValueParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationIdWithCertValueParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
ApplicationIdWithPasswordParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
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 .
Outputs