Quantcast
Channel: Azure Management Portal forum
Viewing all articles
Browse latest Browse all 4189

Make Azure Runbooks

$
0
0

Hello all, I'm new on this azure and want to create an azure RunBook to turn off and start machine.

I have looked online and in forums and I found the code that I attached but I don't know how to tell the machine to turn off and data necessary to make accessing my azure par aapagarla system or start it.

Helps to see if I can indicate how it work.

The error that I get is that the name is empty. I hope your news.

A greeting and thanks

Alberto

workflow IniciarVM
{
    #Connect-Azure -AzureConnectionName
    $subscriptionName = "Microsoft Partner Network"
    Connect-Azure -AzureConnectionName $subscriptionName
    Select-AzureSubscription $subscriptionName

    # Get VMs
    $VMs = Get-AzureVM

    if( $VMs.Count -gt 0 ){

        Foreach($vm in $VMs){
            $vmName = $vm.Name
            Write-Verbose "Starting $vmName"
            Start-AzureVM -ServiceName $vm.ServiceName -Name $vm.Name
        }"All machines are now started!"
    }
    else{"You don't have machines in this subscription"
    }
}


Viewing all articles
Browse latest Browse all 4189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>