Posts tagged ‘Azure SDK’

As you know we recently add DNS services into preview mode and you can subscribe to this service using Request-AzureProvideFeature like that

Request-AzureProvideFeature -ProviderNamespace Microsoft.Network -FeatureName azurednspreview

So good question here is about how get list of all possible available options for FeatureName ?

Continue reading ‘List of all available preview services in Azure’ »

Using PowerShell scripts may give you a lot of power and here’s some nice things which I found very useful for myself. For example we have Azure SDK command ‘Get-AzureLocation’ which give you a complete list of cloud resource types and their locations. For me output of that command looks a little bit complex ( adding ‘more‘ makes it a little bit better ) :
Get-AzureLocation output example

A lot of information, isn’t it ?  So what I really want is just list where my VMs can be deployed. To make this list I’m going to filter this output only with “*compute*” mask and I will do it only for first column. Before I will do it I need to figure out name of first column ( if it’s printed under ‘Name’ column it not always means that objects returned by Get-AzureLocation are under exact that name ), so I will check that properties of object do we have for that output with Get-Member:

PS C:\temp> Get-AzureLocation| Get-Member
TypeName: Microsoft.Azure.Commands.Resources.Models.PSResourceProviderLocationInfo
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Locations Property System.Collections.Generic.List[string] Locations {get;set;}
LocationsString Property string LocationsString {get;set;}
Name Property string Name {get;set;}

Okay so here we have three properties : Locations, LocationsString and Name. So let’s print everything which is about my VMs ( can be filtered with ‘*compute*’ ) using Where-Object : Get-AzureLocation | Where-Object Name -like "*compute*

Get-AzureLocation output example

Okay, so now it’s much better. Just in case if that command doesn’t work try to switch into AzureResourceManager mode ( it might happen that you’re now in AzureServiceManagement mode which works in a little bit different way ) :

Switch-AzureMode -Name AzureResourceManager

 

We can improve that by printing only ‘LocationsString’ property by Select-Object :
Get-AzureLocation | Where-Object Name -like "*compute*" | Select-Object LocationsString

Get-AzureLocation print compute only resources