Skip to content

Runbook Not Working #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Richsaunds opened this issue Mar 16, 2022 · 2 comments
Open

Runbook Not Working #2

Richsaunds opened this issue Mar 16, 2022 · 2 comments

Comments

@Richsaunds
Copy link

Looking to use both this runbook and the Turn Off one as well to ensure VM's are powered on first before being Updated, using Azure Server Update Management (ASUM).

We can set the pre-script for our update deployment schedule to this Runbook, Update-management-turn-on-vms but when the update deployment runs, this runbook fails with multiple errors.

  • Get-AzureRmResource : Parameter set cannot be resolved using the specified named parameters. At line:111 char:23 + ... nResource = Get-AzureRmResource -ResourceType Microsoft.Automation/Au ...

  • New-AzureRmAutomationVariable : Cannot validate argument on parameter 'ResourceGroupName'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. At line:125 char:50

  • Set-AzureRmContext : Parameter cannot be processed because the parameter name 'Subscription' is ambiguous. Possible matches include: -SubscriptionId -SubscriptionName. At line:142 char:40

  • Get-AzureRmVM : A parameter cannot be found that matches parameter name 'DefaultProfile'. At line:144 char:68 + ... RmVM -ResourceGroupName $rg -Name $name -Status -DefaultProfile $mute

  • Cannot index into a null array. At line:147 char:5 + $state = ($vm.Statuses[1].DisplayStatus -split " ")

  • Set-AzureRmContext : Parameter cannot be processed because the parameter name 'Subscription' is ambiguous. Possible matches include: -SubscriptionId -SubscriptionName. At line:142 char:40

  • Get-AzureRmVM : A parameter cannot be found that matches parameter name 'DefaultProfile'. At line:144 char:68 + ... RmVM -ResourceGroupName $rg -Name $name -Status -DefaultProfile $mute

  • Cannot index into a null array. At line:147 char:5 + $state = ($vm.Statuses[1].DisplayStatus -split " ")

  • Set-AutomationVariable : Variable not found. To create this Variable, navigate to the Variables blade and create a Variable named:

To my very untrained eye, it looks like the runbook is not able to parse the passed variable from the Update Management API,
param(
[string]$SoftwareUpdateConfigurationRunContext
)

From what I understand, this is passed from Update Management directly when a deployment is ran.

Output from the runbook does display the name of the VM's selected to be update, but no action to start the VM's is attempted,
Environments Context


{[AzureCloud, AzureCloud], [AzureChinaCloud, AzureChinaCloud], [AzureUSGovernment, AzureUSGovernment]} Microsoft.Azur...

Subscription Id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

NxAVD-4: no action taken. State:

Subscription Id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

NxAVD-5: no action taken. State:

@Klaas-
Copy link

Klaas- commented Mar 16, 2022

hey :) the MS people are not that good with github issues; it's usually faster to get results via a support case.

Having said that, I do use the script it it's current version, usually errors like these happen when you use modules that are not correct for this script :)

@mdezeeuw-visionplanner
Copy link

There are two options to solve this issue:

  1. Update all AzureRM.xxxx modules in your Azure Automation account
  2. The best options is to replace AzureRm by Az in the PowerShell scripts. I just created a PR to update the scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants