Azure Runbooks
4 TopicsNeed help with Azure VM reboot which checks users logged in.
Hi guys, I have been looking for methods to restart AVD using runbooks and automation. I have info on how to restart VMS, but I want to restart the VMs such that it checks if any users are logged in and if the users are logged in. It won't restart. This is the script that I found to restart from linkedin: https://www.linkedin.com/pulse/scheduling-reboot-azure-virtual-machines-using-automation-rabea/: workflow demo { InlineScript { Connect-AzAccount -Identity Restart-AzVM -ResourceGroupName "Resource Group name" -Name "VM1 name" Restart-AzVM -ResourceGroupName "Resource Group name" -Name "VM2 name" Restart-AzVM -ResourceGroupName "Resource Group name" -Name "VM3 name" } }966Views0likes4CommentsHow to authenticate PowerShell cmdlets in Runbooks with managed identities?
Hi there. This is regarding Azure Automation Runbooks. I'm attempting to replace AzureRunAs connections with user/system managed identities. One problem I ran into with this is that I have no idea how to get the PowerShell cmdlet's used in those Runbooks to authenticate. For example for a Runbook that relies on the ExchangeOnline cmdlet's I was able to use the AzureRunAs connections credentials via Get-AutomationConnection –Name "AzureRunAsConnection". Since this AzureRunAs connection is also an App Registration in Azure, I could assign API permissions to them, like for ExchangeOnline. The AzureRunAs connection also comes with a certificate that I could make use of for authentication purposes. On way I thought I could achieve this is for example with: Copy Connect-ExchangeOnline -ManagedIdentity -Organization <tenant>.onmicrosoft.com -ManagedIdentityAccountId <id> So to summarize, my question is: How should I authenticate PowerShell cmdlet's without AzureRunAs connections in Runbooks? Thanks for your help.2.3KViews0likes2CommentsAzure runbook restart during execution
Hello, I have a runbook to read all site collections from multi geolocation and get sca. There are more than 200000 site collection which needs to be processed. I am calling a child runbook from the partent runbook to get SCAs in batch of 500 site collections each. There should be around 450~500 child runbook jobs created during the excution of parent runbook. While I am executing the parent runbook, it is getting restarted from the begning during its execution. The total duration of execution of parent runbook in only 30 mins. Can anyone will help me in understaning why the parent runbook execution is getting resatrted from the begning in between? Does a fair share limit has to do with the restart of parent runbook? Regards, Ratnesh1.3KViews0likes1CommentAzure Runbook if statement does not work
In the last part of the below code block the if statement is not evaluated. The user is always added to the team no matter what the company name is. Any suggestions? Param( [string]$teamname, #The name of the Team [string]$teamowner, #The email address of the owner of the Team [string]$teamalias, #The bit of the teamname you want to be the URL [string]$external, #external sharing enabled? [string]$company #to determine site owner from IT ) #Connect to Teams PowerShell $cred = Get-AutomationPSCredential -Name "TestAdmin" $teams = Connect-MicrosoftTeams -Credential $cred #Create the Team and add owners, ensure added to address list and can be found in exchange groups $newteam = New-Team -MailNickname $teamalias -DisplayName $teamname -Owner $teamowner -Visibility Private Start-Sleep -Seconds 180 Add-TeamUser -GroupId $newteam.GroupId -User user1@domain.com -Role Owner if($company = "CompanyName1") { Add-TeamUser -GroupId $newteam.GroupId -User user2@domain.com -Role Owner }4.3KViews0likes1Comment