azure - 获取-AzDenyAssignment : 'directoryObjectId' cannot be null

标签 azure powershell

我正在尝试按照 docs 列出我的 Azure 订阅中的拒绝语句,但是,我收到此错误:

PS /Users/me> Get-AzDenyAssignment
WARNING: We have migrated the API calls for this cmdlet from Azure Active Directory Graph to Microsoft Graph.
Visit https://go.microsoft.com/fwlink/?linkid=2181475 for any permission issues.
Get-AzDenyAssignment: 'directoryObjectId' cannot be null.

输出中列出的页面没有有关directoryObjectId 的任何信息。

我还尝试过其他组合,例如

PS /Users/me> Get-AzDenyAssignment -ResourceGroupName my-resource-group
WARNING: We have migrated the API calls for this cmdlet from Azure Active Directory Graph to Microsoft Graph.
Visit https://go.microsoft.com/fwlink/?linkid=2181475 for any permission issues.
Get-AzDenyAssignment: 'directoryObjectId' cannot be null.

有什么想法吗?

<小时/>

我的环境:

PS /Users/chris.snow> Get-Module

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.9.0                 Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzCont…
Script     6.0.1                 Az.Resources                        {Export-AzResourceGroup, Export-AzTemplateSpec, …
Script     1.10.0                Microsoft.Graph.Authentication      {Add-MgEnvironment, Connect-MgGraph, Disconnect-…
Script     1.10.0                Microsoft.Graph.DirectoryObjects    {Confirm-MgDirectoryObjectMemberGroup, Confirm-M…
Manifest   7.0.0.0               Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-Item, Clear-I…
Manifest   7.0.0.0               Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-O…
Script     1.4.7                 PackageManagement                   {Find-Package, Find-PackageProvider, Get-Package…
Script     2.2.5                 PowerShellGet                       {Find-Command, Find-DscResource, Find-Module, Fi…
Script     2.1.0                 PSReadLine                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption,…

最佳答案

  • 我们可以在Azure PortalAzure CLI中查看azure订阅的拒绝语句列表 em> 或使用REST API

  • 在检查列表之前,请确保您拥有 MSDoc 中提到的所需权限。

检查 Azure 门户中的角色

打开Azure 门户 => 订阅 => 选择您的订阅 =>访问控制 (IAM) => 检查访问 => 查看我的访问权限 enter image description here

从 Azure 门户查看

导航至Azure 门户 => 订阅 => 选择您的订阅 =>访问控制 (IAM) => 点击查看拒绝分配选项卡

enter image description here

使用 Azure CLI

Get-AzDenyAssignment

enter image description here

使用 REST API

GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/denyAssignments/{deny-assignment-id}?api-version=2018-07-01-preview
  • 范围 - 我已给出Subscriptions/“MySubscriptionID”

enter image description here

关于azure - 获取-AzDenyAssignment : 'directoryObjectId' cannot be null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73064210/

相关文章:

c# - API 随机调用失败 - 请求被中止 : Could not create SSL/TLS secure channel

windows - 桌面路径的环境变量是什么?

arrays - PowerShell在CSV中查找重复项并输出不同的标题

powershell - 如何使用 PowerShell 替换文件中出现的每个字符串?

powershell - 用于配置 Azure Web App 持续部署的脚本(网站)

amazon-web-services - 简单地使用 kubeconfig 上下文

azure - 诊断日志记录设置是否按设计自行关闭?

c# - 查询参数中包含 %2B 的 ASP.net core 3.0 GET 方法在 Azure 上不起作用

Azure Web 作业在应用程序服务中的辅助插槽中交换

azure - 如何在没有 user_impersonation OAuth2Permission 的情况下创建新的 Azure 应用程序注册?