workflow Powershell

Jacek Spychala 1 Reputation point
2022-07-27T11:52:43.957+00:00

Hello

Please support

![225247-image.png]2

Port is taken....

225302-image.png

225233-image.png

I product that problem is related with the Ideinty that cannot work with the Subsiption in Automation account

Part of my code :

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

log AccountId

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

log AccountId

"Test1"
Connect-AzAccount -AccountId $UserManagedIdentityAccountId
"Test2"
Connect-AzureAD -AccountId $UserManagedIdentityAccountId
"Test3"

### Scipt Block Query

$UserManagedIdentityAccountId = "XYZ"
$groups = Get-AzADGroup -SearchString $GroupName
$Exp = foreach($group in $groups){
$GroupId = $group.Id
$GroupName = $group.DisplayName
Get-AzADGroupMember -ObjectId $GroupId | Select-Object -Property @{Name = 'GroupName'; Expression= {$GroupName}}, DisplayName,Id

Write-Output $Exp

}
}

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.