Manage your AzureVMs

If you are handling by first time the Azure subscription, you can put the face as sitting in the millennial falcon… what this button stands for??

don’t worry, Azure is bringing so much that is simply impossible to afford all in a month. you keep learning all the time about it.

The Azure team, and the Office 365 got a plan, and they bring new capabilities every couple of weeks. as MCT we get a message directly from corp. where we was clearly advised to handle this courses with the actual material, and this MOC will be updated more frequently, than regular ones.

so, get back to the intention of this post. how can I manage my remaining U$200 of my trial, and stretch it so much as I can. well. first, if you’re patient, use the GUI and turn on/off your machines every time you’re gonna use them. if you don’t, try installing the Azure PowerShell module, and then run the following  script to start your AzureVMs.

Start-AzureVM -ServiceName CloudDemo001 -Name BOGDC01
Import-module azure
Import-AzurePublishSettingsFile -PublishSettingsFile ‘c:\users\fcamp\Downloads\MSDN-11-5-2015-credentials.publishsettings’
$servicename = ‘CloudDemo001’
#get-AzureVM -ServiceName CloudDemo001 |ft
$name = ‘BOGDC01’
$userName = ‘admin’
$password = «WarMachineIsTheBest»
$vm = Get-AzureVM -ServiceName $servicename -Name $name
If ($vm.InstanceStatus -ne ‘ReadyRole’)
Write-Host («VM is not running. InstanceStatus:» + $vm.instancestatus)
$port = ($vm.VM.ConfigurationSets.Inputendpoints | Where { $_.LocalPort -eq 5986 }).Port
$vip = ($vm.VM.ConfigurationSets.Inputendpoints | Where { $_.LocalPort -eq 5986 }).Vip
$uri = (‘https://’ + $vip + ‘:’ + $port)

$Credential = New-Object System.Management.Automation.PSCredential($username, $(ConvertTo-SecureString -String $password -AsPlainText -Force))
$SessionOption = New-PSSessionOption -SkipCACheck -SkipCNCheck -NoMachineProfile
$PSSession = New-PSSession -ConnectionUri $uri -Credential $Credential -SessionOption $SessionOption

Enter-PSSession $PSSession

Stop-AzureVM -ServiceName CloudDemo001 -Name BOGDC01
Function Get-Uptime {
Displays Uptime since last reboot
.PARAMETER  Computername
Get-Uptime Server1
«Server1», «Server2″|Get-Uptime
(Get-Uptime Sever1).»Time Since Last Reboot»
Param (

Begin {Write-Verbose «Version 1.00»}

Process {
$LastBoot=[System.Management.ManagementDateTimeConverter]::ToDateTime((Get-WmiObject win32_operatingsystem -ComputerName $computername).lastbootuptime)
$Result=@{ «Server»=$($Computername);
«Last Reboot»=$LastBoot;
«Time Since Reboot»=»{0} Days {1} Hours {2} Minutes {3} Seconds» -f ($Now – $LastBoot).days, `
($Now – $LastBoot).hours,($Now – $LastBoot).minutes,($Now – $LastBoot).seconds}
Write-Output (New-Object psobject -Property $Result|select Server, «Last Reboot», «Time Since Reboot»)

Dejar un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *