【问题标题】:Azure PowerShell Workflow / Identity Problems / AutomationAzure PowerShell 工作流/身份问题/自动化
【发布时间】:2022-08-05 14:44:24
【问题描述】:

我在自动化帐户中遇到身份问题 - 当我运行以下代码时

我面临的错误是:

在调用任何其他 cmdlet 之前,您必须调用 Connect-AzureAD cmdlet。

脚本块:

workflow test
{
    Param
(
  [Parameter(Mandatory= $True)]
  [String] $GroupName,
  [Parameter(Mandatory= $True)]
  [String] $DestinationEmailAddress
)

# log AccountId
$UserManagedIdentityAccountId = \"XYZ\"
Disable-AzContextAutosave -Scope Process
$AzureContext = (Connect-AzAccount -Identity -AccountId $UserManagedIdentityAccountId).context
$AzureContext = Set-AzContext -SubscriptionName $AzureContext.Subscription -DefaultProfile $AzureContext
# log AccountId 

$groups = Get-AzureADGroup  -SearchString  $GroupName

$Exp = foreach($group in $groups){
     $GroupId = $group.ObjectId
     $GroupName = $group.DisplayName
     Get-AzureADGroupMember -ObjectId $GroupId | Select-Object -Property @{Name = \'GroupName\'; Expression= {$GroupName}}, DisplayName, UserPrincipalName, usertype
 }

Write-Output $Exp 

Write-Output $GroupName
Write-Output $DestinationEmailAddress

}
  • 如果您将Connect-AzureAD 放在# log AccountId 之后会发生什么情况
  • 来自自动化帐户的相同响应:您必须在调用任何其他 cmdlet 之前调用 Connect-AzureAD cmdlet。
  • 在运行Get-AzureADGroup 命令之前,我们需要使用Connect-AzureAD 命令登录到 Azure AD 模块
  • 哇 !伙计们 - 它有帮助!现在我面临其他问题...发生了一个或多个错误。:无法在 DLL \'iphlpapi.dll\' 中找到名为 \'GetPerAdapterInfo\' 的入口点。发生一个或多个错误。在 DLL \'iphlpapi.dll\' 中找不到名为 \'GetPerAdapterInfo\' 的入口点。出现一个或多个错误。: 无法在 DLL \'iphlpapi.dll\' 中找到名为 \'GetPerAdapterInfo\' 的入口点。在调用任何其他 cmdlet 之前,您必须调用 Connect-AzureAD cmdlet。
  • 我有一个基金,但它与 RUNAS CONNECTION 相关联,我需要 Acc ID 的解析。 stackoverflow.com/questions/54272880/…

标签: azure powershell workflow identity azure-automation


【解决方案1】:

在调用任何其他 cmdlet 之前,您必须调用 Connect-AzureAD cmdlet。

根据此MSDoc,要运行和验证任何 Azure AD 命令,我们需要首先使用Connect-AzureAD 命令连接到经过身份验证的帐户

  • 每次启动新会话时,Powershell 都会要求您进行身份验证并连接到帐户

出现一个或多个错误。: 无法在 DLL 'iphlpapi.dll' 中找到名为 'GetPerAdapterInfo' 的入口点。

请检查此SO Thread 以修复上述错误

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-08-31
    • 1970-01-01
    • 1970-01-01
    • 2017-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-21
    相关资源
    最近更新 更多