【发布时间】:2023-03-11 14:22:01
【问题描述】:
我想从 Azure 自动化分配 Teams 策略。为此,我在当前版本中使用了 PowerShell 模块“MicrosoftTeams”。
当我使用用户凭据登录 Teams 时,如下所示,分配工作。
$Cred = Get-AutomationPSCredential -Name 'Teams-Admin'
Connect-MicrosoftTeams -TenantId $tenantId -Credential $Cred
# Grant policys
Grant-CsUserPolicyPackage -Identity $mailAddress -PackageName Test
但是,我想使用 Run-As 帐户登录,如下图所示。当我这样做时,我得到一个错误。
$connection = Get-AutomationConnection –Name AzureRunAsConnection
Connect-MicrosoftTeams -TenantId $connection.TenantID `
-ApplicationId $connection.ApplicationID `
-CertificateThumbprint $connection.CertificateThumbprint
# Grant policys
Grant-CsUserPolicyPackage -Identity $mailAddress -PackageName Test
错误如下:
Grant-CsUserPolicyPackage : Powershell 管理域意外地为空/空
“运行方式”帐户的应用注册表具有团队管理员和 Skype for Business 管理员角色。此外,我已将 API 权限中的“AppCatalog.ReadWrite.All”、“Group.ReadWrite.All”、“User.Read.All”权限委派给 Microsoft Graph,并将“user_impersonation”权限委派给 Skype 和 Teams 租户管理 API。
【问题讨论】:
-
您能分享一下您的团队模块版本吗?
-
@HunaidHanfee-MSFT 我使用 MicrosoftTeams 模块 2.3.1 版
标签: powershell microsoft-teams azure-automation azure-authentication