Uncategorized

Tag Azure VMs and Resources

Tagging in Azure is a massively useful feature.  I have customers who are interested in identifying resources for billing but they are also a very useful tool for control.  Resources can be grouped by tag and then a script can be used to apply a function to all machines or services with the same tag.

In the example below I call a variable that looks for Azure resources where the type is identified as a Microsoft virtual machine.  Calling this function enables me to extract a range of information. (I fact this script then goes on and uses the ResourceId too)

As referenced in Using tags to organize your Azure resources tags are updated as a whole so if you want to add additional tags you first have to call the existing tags.  In the example below I am adding the new tag to my existing tags.

Finally we are looping this for each vm and applying via a set command.

Hope this is of use to you, happy tagging :-)!


$FindVMs = Find-AzureRmResource | where {$_.ResourceType -like "Microsoft.Compute/virtualMachines"}
$Tags = (Get-AzureRmResource -ResourceId $ResourceId).Tags
$Tags += @{ Owner = "wade" }

Foreach ($vm in $Findvms)
{
$ResourceId = $VM.ResourceId
Set-AzureRmResource -Tag $Tags -ResourceId $ResourceId -Force
}

Disclaimer:  Please note although I work for Microsoft the information provided here does not represent an official Microsoft position and is provided as is.

Auto Shutdown ASM Virtual Machines in Azure | Azure Automation

I put together a quick script to auto shutdown tagged ARM VMs.

There are many people still running ASM VMs and why wouldn’t you they are still supported (as of 9/2016).

The process is not much different and in fact now Azure Automation enables a RunAs account at set up its much easier to configure.

In the example below I have tacked on changes to the Azure Automation Team’s sample script, one of four created for you when you enable the feature.

<# .DESCRIPTION An example runbook which gets all the Classic VMs in a subscription using the Classic Run As Account (certificate) and then shuts down running VMs .NOTES AUTHOR: Azure Automation Team + Jonathan Wade LASTEDIT: 28-08-2016 #>

$ConnectionAssetName = "AzureClassicRunAsConnection"
$ServiceName = "wadeclassiv01"
	
# Get the connection
$connection = Get-AutomationConnection -Name $connectionAssetName        

# Authenticate to Azure with certificate
Write-Verbose "Get connection asset: $ConnectionAssetName" -Verbose
$Conn = Get-AutomationConnection -Name $ConnectionAssetName
if ($Conn -eq $null)
{
    throw "Could not retrieve connection asset: $ConnectionAssetName. Assure that this asset exists in the Automation account."
}

$CertificateAssetName = $Conn.CertificateAssetName
Write-Verbose "Getting the certificate: $CertificateAssetName" -Verbose
$AzureCert = Get-AutomationCertificate -Name $CertificateAssetName
if ($AzureCert -eq $null)
{
    throw "Could not retrieve certificate asset: $CertificateAssetName. Assure that this asset exists in the Automation account."
}

Write-Verbose "Authenticating to Azure with certificate." -Verbose
Set-AzureSubscription -SubscriptionName $Conn.SubscriptionName -SubscriptionId $Conn.SubscriptionID -Certificate $AzureCert 
Select-AzureSubscription -SubscriptionId $Conn.SubscriptionID

# Get cloud service
    
$VMs = Get-AzureVM -ServiceName $ServiceName

    # Stop each of the started VMs
    foreach ($VM in $VMs)
    {
		if ($VM.PowerState -eq "Stopped")
		{
			# The VM is already stopped, so send notice
			Write-Output ($VM.InstanceName + " is already stopped")
		}
		else
		{
			# The VM needs to be stopped
        	$StopRtn = Stop-AzureVM -Name $VM.Name -ServiceName $VM.ServiceName -Force -ErrorAction Continue

	        if ($StopRtn.OperationStatus -ne 'Succeeded')
	        {
				# The VM failed to stop, so send notice
                Write-Output ($VM.InstanceName + " failed to stop")
	        }
			else
			{
				# The VM stopped, so send notice
				Write-Output ($VM.InstanceName + " has been stopped")
			}
		}
    }


Disclaimer:  Please note although I work for Microsoft the information provided here does not represent an official Microsoft position and is provided as is.

Are Mirco Apps Changing Everything?

I come from a desktop / application background, I’ve spent most of my IT career working with one flavour or another of Citrix’s XenApp platform (I’ve been through all the name changes) and am currently employed by Citrix as a Systems Engineer in Australia.  To that end I’ve spent a lot of time working with apps; in the early days that meant hacking them as best I could to squeeze them onto a multi-user platform.  This kept me extremely busy however in reality was always a marginal activity, in that most applications were being installed onto desktops.  I saw a major change with my involvement in the launch of an “e” project in 1999; “e” stood for electronic and the company I was working with started investing heavily in creating web front ends to all applications.  The end result was that vast numbers of apps were rolled out onto MetaFrame because users wanted the full application and the business wanted to centralise. (I say business but it was in fact the IT division’s idea).  The end result for me was that I saw the business demanding fully functional applications and the impact of that project has stuck with me ever since.

I often sit with customers today and one statement I hear myself saying again and again is “do you have a desktop or application problem?” The point I am trying to highlight is that maybe we can solve the issue they have raised by pulling out the applications that require attention.  And not look at reworking their desktop strategy. After all it’s the apps that are important?

Recently I found myself again pondering this scenario and so I tweeted “It’s all about the apps, always had been always will be” and this generated a number of responses.  The first that came back was from @bramwolfs “I think it’s all about the data not specifically the apps..” Which immediately had me thinking there was little way out of this; data exists and is manipulated by apps, my focus has always been on the apps and that is where I make my money so that is where I placed my bet.  @KBaggerman highlighted a blog post titled “VDI OK What’s Next” by Stephane Thirion a Citrix CTP (@archynet) talking about desktops versus applications and applications versus data.  He makes some interesting points about the relationships between data and applications and the importance of data.  I can only agree however I would add that as some apps sole purpose is to collect and create data it is hard to define and almost irrelevant to consider which came first or which is more important, both are a requirement.

More interestingly he talks about user habits and the requirement of a desktop operating system, he also talks about the rise of mobile apps or micro apps; i.e.  apps created for a single purpose that do not require interaction or workflows with other applications and therefore do not require a desktop operating system.

This to me is an interesting area of development and I believe we are seeing two forces at play; the rise of SaaS and its adoption and the influence of the iPad and tablet.  Firstly SaaS is entering every workplace, I was recently  hosting a CIO round table discussion and every CIO was focused on SaaS and in fact the most interesting comment was “every app I deliver I now have to compete against a SaaS app, that is the way I have to think.” And you know what I think he was right; if you enforce a monolithic set of apps onto a workforce and it is not meeting the needs of a business unit then you can bet within days that business unit will be hunting out an alternative and swiping their credit card when they find something they like. Secondly the iPad factor, all apps on the iPad have single functions, I book my travel, check my email, look at website and knock over blocks with very upset birds.  Each app performs well and every day I use them I am breaking the habit of having to work within an operating system.  And therefore every day that operating system becomes less relevant to me.

Can we drop the operating system, no there are too many applications built for that platform. Is the desktop operating system becoming less relevant, yes however this has to be taken into context, just take a look at how many Windows 7 licenses have been sold since release.  But I do think that the mico app aided by the choice and availability on offer from SaaS vendors is accelerating change.

UPDATE  If you want  to read some interesting points head back to  “VDI OK What’s Next” by Stephane Thirion and join in or have a read.

It is still all about the apps…now give me a virtual desktop

I spend a lot of my time talking to customers and many invite me into their organisation to talk about virtual desktops, in fact they often mark the subject of the meeting VDI.  I’m always interested in what customers are up to and I often learn a lot from what they are doing and how they are using IT to drive their business forward.  Be that a large multi-national mining company, a small not for profit care agency or somewhere in between, the conversations are all interesting and everyone has their challenges.

Moving Ore and looking after the elderly present very different challenges when it comes to information management however all want to discuss VDI. In other words all think that VDI will meet a need in their business.  Some will argue that this conversation has been happening for some time and is nothing new, I can hear you yawning now and shouting: “its vendor push, its market hype, it can’t be done for less than a gazillion dollars, the user experience is rubbish and technically it’s too hard.  Come on people have been blogging about this for years, get with the program and write something about Big Data please!”

So why do customers keep coming back to the topic and where is the common value?  I believe the common value starts with the apps, all businesses run on applications.  It is applications that allow them to organise and process data into a meaningful product enabling the business to function.  Centralising apps, so all information can be processed in one place, i.e. all data is in one place makes a lot of sense.  So when I listen to organisations discuss their business needs it is applications we often come round to talking about.

The next stage with any customer is to trial and test our technology.  This means I get to spend time on site with my sleeves rolled up implementing products and integrating them into a proof of concept environment.   These days I just about always implement a NetScaler VPX for remote access, XenDesktop and XenApp.  At the end of every trial XenApp will have met the application requirements as discussed but it is XenDesktop that almost always has the customer most excited about their next desktop roll out.  If you get VDI right, then yes apps are as important as ever but virtual desktops is what the customer wants to do.  You cannot in my opinion underestimate the value of desktop virtualisation, the ability to rapidly deploy, enable a single user experience from any location and to give a user a desktop that is always available without carrying a device.