question

KalaimaniThirupathi-5306 avatar image
0 Votes"
KalaimaniThirupathi-5306 asked SadiqhAhmed-MSFT commented

Azure PowerShell to restart the Azure backup agent (Windows and Linux )

Dear All,


I need your help to restart the Azure backup agent (Windows and Linux ) using azure PowerShell.

azure-backup
· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Can you some help with this, please

0 Votes 0 ·

@KalaimaniThirupathi-5306 MARS Agent is a Windows app.....doesn't work on Linux.

May I know the exact scenario/purpose for restarting Azure backup agent using PowerShell?

0 Votes 0 ·

Dear @SadiqhAhmed-MSFT Backup is failing due to the agent not being ready state.

0 Votes 0 ·
SadiqhAhmed-MSFT avatar image SadiqhAhmed-MSFT KalaimaniThirupathi-5306 ·

@KalaimaniThirupathi-5306 The title on this thread is just confusing, as there is no MARS version for Linux .

For any windows service you can use the command Get-Service and then pipe the result into Stop-Service or Start-service.
Examples:
Get-Service obengine | stop-service
Get-Service obengine | start-service


If the response helped, do "Accept Answer" and up-vote it.

0 Votes 0 ·
Show more comments
KalaimaniThirupathi-5306 avatar image
1 Vote"
KalaimaniThirupathi-5306 answered SadiqhAhmed-MSFT commented

Here are the solution to reboot the agent services.

CLI:
az vm extension set --resource-group rgName --vm-name vmName --name CustomScript --publisher Microsoft.Azure.Extensions --version 2.0 --settings '{"commandToExecute": "systemctl restart waagent.service or systemctl restart walinuxagent.service based on the distro"}'

PowerShell:
Set-AzureRmVMExtension -ResourceGroupName <resourceGroupName> -VMName <vmName> -Location <location> -Publisher Microsoft.Azure.Extensions -ExtensionType CustomScript -Name CustomScript -TypeHandlerVersion 2.0 -SettingString '{"commandToExecute": "systemctl restart waagent.service or systemctl restart walinuxagent.service based on the distro"}'

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@KalaimaniThirupathi-5306 Thanks for sharing the solution. This would certainly be helpful to others on this community.

0 Votes 0 ·
learn2skills avatar image
0 Votes"
learn2skills answered KalaimaniThirupathi-5306 commented

Hi @KalaimaniThirupathi-5306

Your question is already answered, Please follow the below url.
https://stackoverflow.com/questions/58688682/using-powershell-can-we-do-automation-script-to-auto-restart-the-azure-vm-agent




If the Answer is helpful, please click Accept Answer and up-vote, this can be beneficial to other community members.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Sorry, that is not helping; I have checked already.

0 Votes 0 ·