简体   繁体   English

当我尝试通过 AzAD 模块创建新的客户端密码时出现“已添加具有相同密钥的项目”错误

[英]Getting "An item with the same key has already been added" Error when I try to create a new client secret via AzAD module

I'm quite puzzled.我很困惑。 I'm trying to use powershell to create a new client secret for an Azure application.我正在尝试使用 powershell 为 Azure 应用程序创建新的客户端密码。 I'm hitting the error "An item with the same key has already been added" but there's currently no client secret assigned to the application.我遇到错误“已添加具有相同密钥的项目”,但目前没有为应用程序分配客户端密码。 Any ideas would be great.任何想法都会很棒。

Connect-AzAccount

 $sp = Get-AzADServicePrincipal -DisplayName "TS-Test-14-Oct-2021"
 
 $start = Get-Date -Format "o"
 $end = (Get-Date).AddYears(1) | Get-Date -Format "o"
 $Guid = (New-guid).toString()


$Password = @{
displayName= 'Hi'
endDateTime= $end
hint= 'NIL'
keyId= "$Guid"
secretText= 'xxxx'
startDateTime= $start
}

New-AzADAppCredential -ObjectId $sp.Id -PasswordCredentials $Password

I tried with your code and facing the same issue我尝试使用您的代码并面临同样的问题

You can try with this code:您可以尝试使用以下代码:

$startDate = Get-Date
$endDate = $startDate.AddYears(3)
$aadAppsecret01 = New-AzureADApplicationPasswordCredential -ObjectId ObjectId CustomKeyIdentifier "Secret01" -StartDate $startDate -EndDate $endDate

OUTPUT OUTPUT

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将vs项目发布到Azure时出错“已添加具有相同键的项目” - Error while publishing a vs project to Azure “An item with the same key has already been added” Azure Function OpenAPI - 已添加错误相同的密钥 - Azure Function OpenAPI - Error same key has already been added Azure 数据工厂 V2 复制数据问题 - 错误代码:2200 已添加具有相同密钥的项目 - Azure data factory V2 copy data issue - error code: 2200 An item with the same key has already been added Azure 数据工厂管道复制数据错误。 将 CSV 导入 SQL 表。 已添加具有相同键的项目 - Azure Data Factory Pipeline Copy Data Error. Importing CSV to SQL Table. An item with the same key has already been added Windows Azure:“已添加具有相同键的项目。” Select引发异常 - Windows Azure: “An item with the same key has already been added.” exception thrown on Select Windows Azure发布网站 - “无法获取订阅信息。已添加具有相同密钥的项目“ - Windows Azure Publish Website- “Unable to get subscription information. An item with the same key has already been added” 条目(数据库)已经添加 - The entry (Database) has already been added 错误:Azure PowerShell 上下文尚未正确初始化。 请导入模块并重试 - Error: The Azure PowerShell context has not been properly initialized. Please import the module and try again Azure CLI - 如何创建具有特定“描述”的新客户端密钥 - Azure CLI - How to create a new client secret with a specific "Description" 使用 Terraform 创建新版本的密钥保管库机密 - Create a new version of key vault secret using Terraform
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM