Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET Coming Soon: GET:IT Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET

Schedule shutdown doesnt recognize default subscription name

Home Forums Cloud Computing Microsoft Azure Schedule shutdown doesnt recognize default subscription name

Viewing 1 post (of 1 total)
  • Author
    Posts

  • 5habbaranks
    Member
    #166222

    Hi,

    I’m looking at the guide to shutting down VM’s within an Azure network the subscription name is Pay-As-You-Go but when I run the script it errors as below:

    06/03/2016 21:26:50, Error: Add-AzureAccount : Cannot bind argument to parameter ‘Credential’ because it is null.
    At stop-vm-server:4 char:4
    +
    + CategoryInfo : InvalidData: (:) [Add-AzureAccount], ParameterBindingValidationException
    + FullyQualifiedErrorId :
    ParameterArgumentValidationErrorNullNotAllowed,Microsoft.WindowsAzure.Commands.Profile.AddAzureAccount

    06/03/2016 21:26:50, Error: Select-AzureSubscription : Parameter set cannot be resolved using the specified named parameters.
    At stop-vm-server:5 char:5
    +
    + CategoryInfo : InvalidArgument: (:) [Select-AzureSubscription], ParameterBindingException
    + FullyQualifiedErrorId :
    AmbiguousParameterSet,Microsoft.WindowsAzure.Commands.Profile.SelectAzureSubscriptionCommand

    06/03/2016 21:26:50, Error: Get-AzureVM : No default subscription has been designated. Use Select-AzureSubscription -Default to
    set the default subscription.
    At stop-vm-server:5 char:5
    +
    + CategoryInfo : CloseError: (:) [Get-AzureVM], ApplicationException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.GetAzureVMCommand[/CODE]

    The Code I’m using is

    [CODE]workflow stop-vm-server
    {
    $Cred = Get-AutomationPSCredential -Name ‘[email protected]
    Add-AzureAccount -Credential $Cred
    InlineScript
    {
    Select-AzureSubscription -Default “Pay-As-You-Go”
    $VMS = Get-AzureVM
    ForEach ($VM in $VMS)
    {   
    $VMName = $VM.Name
      Write-Output “Attempting to shut down VM: $VMName”
      Stop-AzureVM -ServiceName $VM.ServiceName -Name $VM.Name
    }
    }
    }[/CODE][CODE]06/03/2016 21:26:50, Error: Add-AzureAccount : Cannot bind argument to parameter ‘Credential’ because it is null.
    At stop-vm-server:4 char:4
    +
    + CategoryInfo : InvalidData: (:) [Add-AzureAccount], ParameterBindingValidationException
    + FullyQualifiedErrorId :
    ParameterArgumentValidationErrorNullNotAllowed,Microsoft.WindowsAzure.Commands.Profile.AddAzureAccount

    06/03/2016 21:26:50, Error: Select-AzureSubscription : Parameter set cannot be resolved using the specified named parameters.
    At stop-vm-server:5 char:5
    +
    + CategoryInfo : InvalidArgument: (:) [Select-AzureSubscription], ParameterBindingException
    + FullyQualifiedErrorId :
    AmbiguousParameterSet,Microsoft.WindowsAzure.Commands.Profile.SelectAzureSubscriptionCommand

    06/03/2016 21:26:50, Error: Get-AzureVM : No default subscription has been designated. Use Select-AzureSubscription -Default to
    set the default subscription.
    At stop-vm-server:5 char:5
    +
    + CategoryInfo : CloseError: (:) [Get-AzureVM], ApplicationException
    + FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.GetAzureVMCommand[/CODE]

    The Code I’m using is

    workflow stop-vm-server
    {
    $Cred = Get-AutomationPSCredential -Name ‘[email protected]
    Add-AzureAccount -Credential $Cred
    InlineScript
    {
    Select-AzureSubscription -Default “Pay-As-You-Go”
    $VMS = Get-AzureVM
    ForEach ($VM in $VMS)
    {   
    $VMName = $VM.Name
      Write-Output “Attempting to shut down VM: $VMName”
      Stop-AzureVM -ServiceName $VM.ServiceName -Name $VM.Name
    }
    }
    }[/CODE][CODE]workflow stop-vm-server
    {
    $Cred = Get-AutomationPSCredential -Name ‘[email protected]
    Add-AzureAccount -Credential $Cred
    InlineScript
    {
    Select-AzureSubscription -Default “Pay-As-You-Go”
    $VMS = Get-AzureVM
    ForEach ($VM in $VMS)
    {   
    $VMName = $VM.Name
      Write-Output “Attempting to shut down VM: $VMName”
      Stop-AzureVM -ServiceName $VM.ServiceName -Name $VM.Name
    }
    }
    }[/CODE]

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Live Webinar: Active Directory Security: What Needs Immediate Priority!Live on Tuesday, October 12th at 1 PM ET

Attacks on Active Directory are at an all-time high. Companies that are not taking heed are being punished, both monetarily and with loss of production.

In this webinar, you will learn:

  • How to prioritize vulnerability management
  • What attackers are leveraging to breach organizations
  • Where Active Directory security needs immediate attention
  • Overall strategy to secure your environment and keep it secured

Sponsored by: