简体   繁体   English

如何获取与个人用户相关的Azure keyvault的访问策略列表?

[英]How to get the list of access policies of an Azure keyvault related to individual users?

I'm working on a script to remove all the permissions for indivudual users on a keyvault and replacing them with an access policy for a security group instead.我正在编写一个脚本,以删除单个用户对密钥库的所有权限,并将其替换为安全组的访问策略。 With Get-AzKeyVault you can get all the access policies for a key vault, but I don't see a property on the access policy that allows me to differentiate between individual user accounts, applications, and security groups, like the Azure Portal does.使用 Get-AzKeyVault,您可以获得密钥保管库的所有访问策略,但我没有在访问策略上看到允许我区分各个用户帐户、应用程序和安全组的属性,就像 Azure 门户所做的那样。

If you have enough slow browser then you may notice that Azure Portal first load plain list and then group it by type.如果您的浏览器足够慢,那么您可能会注意到 Azure 门户首先加载普通列表,然后按类型对其进行分组。 This is exactly because of same reason as you have: the Graph API can return only the object id and nothing else.这正是因为与您相同的原因:图表 API 只能返回 object id 而没有其他任何内容。 You should get the object to actually find out the type:你应该得到 object 来实际找出类型:

$kv = Get-AzKeyVault -VaultName you-vault-name
# take all object ids for policies
$ids = $kv.AccessPolicies | select -ExpandProperty ObjectId
$objects = Get-AzureADObjectByObjectId -ObjectIds $ids

$objects | % {
    $obj = $_
    $kv.AccessPolicies | ? {$_.ObjectId -eq $obj.ObjectId} | Add-Member -MemberType NoteProperty -Name "Type" -Value $obj.GetType().Name -Force
}

$kv.AccessPolicies | ft

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

相关问题 如何通过 Python 中的专用端点访问 Azure Keyvault? - How to access Azure Keyvault via private endpoint in Python? 如果我们禁用 keyvault 的公共访问,如何访问 Azure 数据工厂 - How to Access Azure Data Factory if we disable public access for keyvault 允许Azure CDN访问Azure KeyVault - Allowing Azure CDN to access Azure KeyVault 在Azure部署访问策略 - Deploying access policies in Azure 获取有权访问 Azure 资源的用户和组 - Get users and groups that have access to Azure resource Azure devops 需要访问 Azure keyvault 仅限私有链接 - Azure devops need to access Azure keyvault which is restrict to private link 如何从 WSO2 API 管理器获取可能的策略列表 - How to Get List of Possible Policies from WSO2 API manager 如何获取我的用户及其消息列表以及相关的当前用户 ID - how can get i users and their messages list with related current user id 如何将一个订阅下的一个 azure 租户(帐户)keyvault 中的密钥共享到另一个订阅中的另一个 azure 租户(帐户)keyvault - How to share a key from one azure tenant(account) keyvault under one subscription to another azure tenant(account) keyvault in another subscription 使用 ARM 模板从 KeyVault 获取 Azure KeyVault 机密到应用服务 - Get Azure KeyVault Secrets from the KeyVault to an App Service using ARM Templates
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM