New-EntraServicePrincipalKeyCredential
Creates a password credential for a service principal.
Syntax
New-EntraServicePrincipalKeyCredential
-ObjectId <String>
[-CustomKeyIdentifier <String>]
[-StartDate <DateTime>]
[-EndDate <DateTime>]
[-Type <KeyType>]
[-Usage <KeyUsage>]
[-Value <String>]
[<CommonParameters>]
Description
The New-EntraServicePrincipalKeyCredential cmdlet creates a key credential for a service principal in Microsoft Entra ID.
Examples
Example 1: Create a key credential
Connect-Entra -Scopes 'Application.ReadWrite.All'
New-EntraServicePrincipalKeyCredential
This command creates a key credential for a service principal.
Parameters
-CustomKeyIdentifier
Specifies a custom key ID.
Type: | System.String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-EndDate
Specifies the time when the key becomes invalid as a DateTime object.
Type: | System.DateTime |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ObjectId
Specifies an object ID.
Type: | System.String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-StartDate
Specifies the time when the key becomes valid as a DateTime object.
Type: | System.DateTime |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Type
Specifies the type of the key.
Type: | KeyType |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Usage
Specifies the key usage.
Type: | KeyUsage |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-Value
Specifies the value for the key.
Type: | System.String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |