0

Im triying run a powershell runbook for tagging...

I've started try tagging a virtual machine , I checked the powershell code and it's working , I've runned the code line to line in powershell console of azure portal and It's working but the same code in runbook doesnt work.....

............................code................................

    #credentials
    $CredentialAssetName = "kevin";
    $Cred = Get-AutomationPSCredential -Name $CredentialAssetName;
    Add-AzureRmAccount -Credential $Cred;
    #----------------------------------------------------------------

    #
    #take tags
    $r = Get-AzureRmResource -ResourceName "centos-master" -ResourceGroupName VirtualMachines;
    $tags=$r.Tags;
    #----------------------------------------------------------------

    #assign tag to resource
    $tags+=@{test3="kevin3"};
    Set-AzureRmResource -ResourceGroupName "VirtualMachines" -Name "centos-master" -ResourceType "Microsoft.Compute/VirtualMachines" -Tag $tags -Force;
    #----------------------------------------------------------------

thanks in advance

kevin
  • 1
  • I didnt receive any error or output error: – kevin Oct 24 '19 at 13:43
  • Try to look at the logs and see if you get any errors: https://learn.microsoft.com/en-us/azure/automation/automation-runbook-execution#viewing-job-status-from-the-azure-portal – AmanGarg-MSFT Oct 27 '19 at 18:39

0 Answers0