【问题标题】:need to invite multiple guest users, and need to create multiple resource group需要邀请多个guest用户,并且需要创建多个资源组
【发布时间】:2021-10-25 06:29:42
【问题描述】:

我们需要一个 PowerShell 脚本来查找哪个资源组没有分配 IAM 角色。

请在下方找到 PowerShell 脚本以供参考,并告诉我用于查找未分配 IAM 角色的资源组的 PowerShell 脚本。

邀请多个用户。

安装-模块 AzureADPreview Connect-AzureAD -TenantId $invitations = import-csv C:\Users\dummy\Desktop\users.csv $messageInfo = 新对象 Microsoft.Open.MSGraph.Model.InvitedUserMessageInfo $messageInfo.customizedMessageBody = "你好。你被邀请到 xyz.onmicrosoft.com." foreach($invitations 中的$email)
{New-AzureADMSInvitation -InvitedUserEmailAddress $email.InvitedUserEmailAddress -InvitedUserDisplayName $email.Name -InviteRedirectUrl https://myapps.microsoft.com -InvitedUserMessageInfo $messageInfo ` -SendInvitationMessage $true }

创建多个资源组。

Connect-AzureRmAccount -Tenant -订阅导入-csv C:\Users\dummy\Desktop\excel02.csv | ForEach-对象 {New-AzureRmResourceGroup -Name $_.Name -Location centralIndia

批量分配 iam 角色

Connect-AzureRmAccount -Tenant -订阅导入-csv C:\Users\dummy\Desktop\excel05.csv | ForEach-对象 {New-AzureRMRoleAssignment -SignInName $.Users -RoleDefinitionName “所有者”-ResourceGroupName $.RG}

批量获取角色分配。

Connect-AzureRmAccount -Tenant -订阅 #Get-AzureRmRoleAssignment -ResourceGroupName MridulAggarwal -SignInName xyz@xyz.onmicrosoft.com import-csv C:\Users\nawabjanm\Desktop\excel05.csv | ForEach-对象 {Get-AzureRmRoleAssignment -ResourceGroupName $.RG -SignInName $.用户} | FL > D:\r20.csv

【问题讨论】:

    标签: powershell csv azure-active-directory


    【解决方案1】:

    请查找以下脚本以确定具有角色分配的资源组及其在特定订阅中的详细信息。因此,下面未列出的资源组肯定是没有任何 IAM 角色分配的资源组。

     Get-AzResourceGroup | ForEach-Object {Get-AzRoleAssignment -ResourceGroupName 
     $_.ResourceGroupName} | export-csv 'C:\res.csv' 
    

    因此,您可以放心使用分配了 IAM 角色的资源组。

    请在下面的链接中找到更多信息:-

    https://docs.microsoft.com/en-us/powershell/module/az.resources/get-azresourcegroup?view=azps-6.3.0

    https://docs.microsoft.com/en-us/azure/role-based-access-control/role-assignments-list-powershell

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-30
      • 1970-01-01
      • 2021-05-01
      • 1970-01-01
      • 2019-02-22
      • 2019-12-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多