【问题标题】:Generating passwords for the Azure Api Management Git repository为 Azure Api 管理 Git 存储库生成密码
【发布时间】:2017-06-30 09:49:54
【问题描述】:

Azure Api Management 可以选择为集成的 git 存储库创建有时限的密码。

作为我们 VSTS 发布管理的一部分,我们希望将我们的更改自动推送到这个 git 存储库。我们不想每个月都通过 Azure 门户创建一个新的 git 密码。

发布者门户提供credentials(带有主键和辅助键的标识符)来生成密码。

但我找不到任何参考如何使用它。有人能给我一些见解吗?

【问题讨论】:

    标签: git azure-api-management


    【解决方案1】:

    您可以使用 REST api 自动执行此过程以获取凭据。

    使用 REST API Get Git UserId

    然后使用 REST API Generate Credentials For User 为用户生成凭据。

    【讨论】:

    • 感谢您的回答!我首选的方式是使用 AzureRM Cmdlet。我可以使用Get-AzureRmApiManagementTenantGitAccess 来获取密钥。但是哪个 cmdlet 对应于生成凭据 REST API?
    • 我们在 cmdlet 中还没有这个。不过你可以用$user = Get-AzureRmApiManagementUser -Context $context | Select-Object -First 1 $subscription = Get-AzureRmApiManagementSubscription -Context $context -UserId $user.UserId | Select-Object -Last 1 $parameters = @{ "keyType"= "primary"; "expiry"= "2017-05-19T10:39:35.000Z"; } Invoke-AzureRmResourceAction -ResourceGroupName $resourceGroupName -ResourceType 'Microsoft.ApiManagement/service/users' -Action 'token' -ResourceName "$serviceName/$($user.UserId)" -ApiVersion "2016-10-10" -Parameters $parameters 少看
    • 感谢代码示例!我不知道Invoke-AzureRmResourceAction cmdlet。
    猜你喜欢
    • 2020-06-05
    • 2014-12-10
    • 1970-01-01
    • 1970-01-01
    • 2022-01-10
    • 2019-05-14
    • 2010-10-23
    • 1970-01-01
    • 2013-12-06
    相关资源
    最近更新 更多