Azure CLI 中的新 AzureADServiceAppRoleAssignment? [英] New-AzureADServiceAppRoleAssignment in Azure CLI?

查看:17
本文介绍了Azure CLI 中的新 AzureADServiceAppRoleAssignment?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Azure CLI 世界中是否有以下命令的挂件?

New-AzureADServiceAppRoleAssignment -ObjectId $clientManagedIdentityObjectId -Id $serverAppRoleId -ResourceId $serverEnterpriseAppObjectId -PrincipalId $clientManagedIdentityObjectId

我想将托管标识添加到企业应用程序中的 appRole.

Is there a pendant in the Azure CLI world for the following command?

New-AzureADServiceAppRoleAssignment -ObjectId $clientManagedIdentityObjectId -Id $serverAppRoleId -ResourceId $serverEnterpriseAppObjectId -PrincipalId $clientManagedIdentityObjectId

I'd like to add a managed identity to an appRole within an Enterprise Application.

az ad app permission add does not seem to do the right thing or I am misinterpreting the underdocumented parameters.

解决方案

There is no built-in cli command to do this, your option is to use az rest call the Microsoft Graph - Grant an appRoleAssignment to a service principal directly.

First, store a .json file as below to your powershell execute location, the meaning of the values see this. e.g. my location is PS C:Usersjoyw>, I store the file in C:Usersjoyw folder.

{
  "principalId": "principalId-value",
  "resourceId": "resourceId-value",
  "appRoleId": "appRoleId-value"
}

Then run the command

az rest --method POST --uri "https://graph.microsoft.com/v1.0/servicePrincipals/{object-id of your Managed identity}/appRoleAssignments" --headers 'Content-Type=application/json' --body `@body.json

这篇关于Azure CLI 中的新 AzureADServiceAppRoleAssignment?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆