New-AzADAppCredential
建立應用程式的金鑰認證或密碼認證。
語法
New-AzADAppCredential
-ObjectId <String>
[-StartDate <DateTime>]
[-EndDate <DateTime>]
[-CustomKeyIdentifier <String>]
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzADAppCredential
-ObjectId <String>
[-StartDate <DateTime>]
[-EndDate <DateTime>]
[-CustomKeyIdentifier <String>]
-CertValue <String>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzADAppCredential
-ObjectId <String>
[-CustomKeyIdentifier <String>]
-KeyCredentials <MicrosoftGraphKeyCredential[]>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzADAppCredential
-ObjectId <String>
[-CustomKeyIdentifier <String>]
-PasswordCredentials <MicrosoftGraphPasswordCredential[]>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzADAppCredential
[-StartDate <DateTime>]
[-EndDate <DateTime>]
[-CustomKeyIdentifier <String>]
-ApplicationObject <IMicrosoftGraphApplication>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzADAppCredential
[-StartDate <DateTime>]
[-EndDate <DateTime>]
[-CustomKeyIdentifier <String>]
-CertValue <String>
-ApplicationObject <IMicrosoftGraphApplication>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzADAppCredential
[-StartDate <DateTime>]
[-EndDate <DateTime>]
[-CustomKeyIdentifier <String>]
-DisplayName <String>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzADAppCredential
[-StartDate <DateTime>]
[-EndDate <DateTime>]
[-CustomKeyIdentifier <String>]
-CertValue <String>
-DisplayName <String>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzADAppCredential
[-StartDate <DateTime>]
[-EndDate <DateTime>]
[-CustomKeyIdentifier <String>]
-CertValue <String>
-ApplicationId <Guid>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzADAppCredential
[-StartDate <DateTime>]
[-EndDate <DateTime>]
[-CustomKeyIdentifier <String>]
-ApplicationId <Guid>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzADAppCredential
[-CustomKeyIdentifier <String>]
-PasswordCredentials <MicrosoftGraphPasswordCredential[]>
-ApplicationObject <IMicrosoftGraphApplication>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzADAppCredential
[-CustomKeyIdentifier <String>]
-PasswordCredentials <MicrosoftGraphPasswordCredential[]>
-DisplayName <String>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzADAppCredential
[-CustomKeyIdentifier <String>]
-PasswordCredentials <MicrosoftGraphPasswordCredential[]>
-ApplicationId <Guid>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzADAppCredential
[-CustomKeyIdentifier <String>]
-KeyCredentials <MicrosoftGraphKeyCredential[]>
-ApplicationObject <IMicrosoftGraphApplication>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzADAppCredential
[-CustomKeyIdentifier <String>]
-KeyCredentials <MicrosoftGraphKeyCredential[]>
-DisplayName <String>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzADAppCredential
[-CustomKeyIdentifier <String>]
-KeyCredentials <MicrosoftGraphKeyCredential[]>
-ApplicationId <Guid>
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
建立應用程式的金鑰認證或密碼認證。
範例
範例 1:建立應用程式的金鑰認證
# 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
使用物件識別碼建立應用程式的密鑰認證$Id
範例 2:建立應用程式的密碼認證
# 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
應用程式識別碼。
類型: | Guid |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-ApplicationObject
應用程式物件可用來做為管線輸入。
類型: | IMicrosoftGraphApplication |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-CertValue
'asymmetric' 認證類型的值。 它代表基底 64 編碼的憑證。
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-Confirm
在執行 Cmdlet 之前,提示您進行確認。
類型: | SwitchParameter |
別名: | cf |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-CustomKeyIdentifier
自訂金鑰標識碼。
格式應該是base64:$Bytes=[System.Text.Encoding]::Unicode.GetBytes($key);$key=[Convert]::ToBase64String($Bytes)
類型: | String |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-DefaultProfile
用於與 Azure 通訊的認證、帳戶、租用戶和訂用帳戶。
類型: | PSObject |
別名: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-DisplayName
應用程式的顯示名稱。
類型: | String |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-EndDate
認證使用方式的有效結束日期。 默認結束日期值是從今天起的一年。 對於「非對稱」類型認證,這必須設定為 X509 憑證有效日期或之前。
類型: | DateTime |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-KeyCredentials
與應用程式相關聯的金鑰認證。
類型: | MicrosoftGraphKeyCredential[] |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-ObjectId
應用程式的物件識別碼。
類型: | String |
別名: | Id |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-PasswordCredentials
與應用程式相關聯的密碼認證。
類型: | MicrosoftGraphPasswordCredential[] |
Position: | Named |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-StartDate
認證使用方式的有效開始日期。 默認開始日期值是今天。 針對「非對稱」類型認證,這必須設定為 X509 憑證的有效日期或之後。
類型: | DateTime |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-WhatIf
顯示 Cmdlet 執行時會發生什麼事。 Cmdlet 未執行。
類型: | SwitchParameter |
別名: | wi |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |