HI @Guzzu, Navya X
You can try this:
Click Identity.

Click Azure role assignments to give the managed identity permissions to access subscription resources.

Click add and give permissions to the resource group where your vms are.

With the identity account created, within the automation resource, click on runbook.

Fill in the runbook information as shown in the following image:

Click in the field on the right and paste the command from above:
Param(
[Parameter(Mandatory = $true)]
[String]
$TagName,
[Parameter(Mandatory = $true)]
[String]
$TagValue,
[Parameter(Mandatory = $true)]
[Boolean]
$Shutdown
)
# Autentication in Azure
## Ensures you do not inherit an AzContext in your runbook
Disable-AzContextAutosave -Scope Process
## Connect to Azure with System-assigned managed identity
$AzureContext = (Connect-AzAccount -Identity).context
#Write-Output -InputObject $AzureContext
## Set and store context
$AzureContext = Set-AzContext -SubscriptionName $AzureContext.Subscription -DefaultProfile $AzureContext
#Write-Output -InputObject $AzureContext
## Start and Stop VMs
$vms = Get-AzResource -TagName $TagName -TagValue $TagValue | Where-Object -FilterScript {
$_.ResourceType -like 'Microsoft.Compute/virtualMachines'
}
Foreach ($vm in $vms)
{
if ($Shutdown -eq $true)
{
Write-Output -InputObject "Stopping $($vm.Name)"
Stop-AzVM -Name $vm.Name -ResourceGroupName $vm.ResourceGroupName -Force
}
else
{
Write-Output -InputObject "Starting $($vm.Name)"
Start-AzVM -Name $vm.Name -ResourceGroupName $vm.ResourceGroupName
}
}
It will look like this:
Publish
Fill in according to the needs of your environment. Pay attention to the time zone. Click create.

he configuration will return to the previous screen. Now click on the settings parameters.
Fill in according to the tags you configured on the VM, in shutdown put true if you want to turn off the VM and false if you want to turn it on.

Get in touch if you need more help with this issue.
--please don't forget to "[Accept the answer]" if the reply is helpful--