gpt4 book ai didi

azure-powershell - powershell az 中等效的 "az ad sp create-for-rbac"是什么

转载 作者:行者123 更新时间:2023-12-02 00:11:21 27 4
gpt4 key购买 nike

powershell 中的 az 命令等价于什么

az ad sp create-for-rbac --query "{ client_id: appId, client_secret: password, tenant_id: tenant }"

我应该向 New-AzADServicePrincipal 添加哪些额外参数

az ad sp create-for-rbac Create a service principal and configure its access to Azure resources.

我想用 powershell az 命令做同样的事情

最佳答案

如果您想通过命令创建 Azure AD 服务原则:New-AzADServicePrincipal 并获取其客户端 ID、客户端密码和租户 ID 作为 cli 命令回复,请尝试以下命令:

$sp = New-AzADServicePrincipal 
$clientsec = [System.Net.NetworkCredential]::new("", $sp.Secret).Password
$tenantID = (get-aztenant).Id
$jsonresp =
@{client_id=$sp.ApplicationId
client_secret=$clientsec
tenant_id=$tenantID}
$jsonresp | ConvertTo-Json

结果:

enter image description here

关于azure-powershell - powershell az 中等效的 "az ad sp create-for-rbac"是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58906662/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com