Troubleshooting Azure Resource Manager Failed Messages

brokenComp

So you’re in the new portal and trying to deploy something? It runs for a while and then fails! The message returned isn’t great and looks something like:

The operation name is: Microsoft.ClassicCompute/virtualMachines/extensions/write The status is: Failed

Well, it happens… A good way to start to troubleshoot that is using PowerShell. Go setup PowerShell if you haven’t already. Then use the command:

Get-AzureResourceGroupLog -Name <ResourceGroupName>

This will return all the log entries from the last deployment. It should provide you a window into what is actually happening. Last I used this was deploying an Azure SQL database. The error I received was lacking detail, but after I ran that command I was able to see that East US was running hot and I need to provision in a different Datacenter…

There are other variations of that command as well. If you want a specific deployment that you’ve run for a resource group you would use this command:

Get-AzureResourceGroupLog -Name <ResourceGroupName> -DeploymentName <DeploymentName>

If you want all the logs for a resource group you would run:

Get-AzureResourceGroupLog -Name <ResourceGroupName> -All

Hope this helps you figure out what’s happening with a Resource Manager based deployment goes wrong!

Visual Studio Code: Yeoman Setup

I’m a huge fan of Sublime Text (and a paying customer), so when I heard we’d released a light weight code editor called Visual Studio Code, I had to go see…

I was happy to see that it is trully light weight, shares some of the Sublime Text layout features, and is cross platform. Awesome… After downloading and installing it, I have to say I was a little lost. This is because I was thinking Visual Studio and not Sublime Text. Once I made that leap and realized there is no file -> New Project I went to work. Here is what I did…

First I noticed on the “Start” screen there is an instruction that states “If you don’t have an existing project, we suggest using Yeoman to scaffold out a new one.”.

vscode

VSCode… use Yeoman

Ok, so let’s do that. I already had node installed so I just walked through verifying I had the latest and greatest node/npm bits using:

node --version && npm --version

This shows that I am in fact running better than:

  • Node.js v0.10.x+
  • npm v2.1.0+

From there let’s get the Yeoman tool-set installed globally.

npm install --global yo bower grunt-cli

Once I’ve installed the tool set, I wanted a generator to scaffold out the project so I don’t have too.

npm install --global generator-angular@0.11.1

Now! I have all the necessary tools to actually lay down some starter bits and get coding. Since I’m using the Yeoman tutorial as the basis to get my project going and I like Angular we’ll scaffold out an Angular starter project.

yo angular

I’m not ready to use Sass right now so I will say no to that and accept the defaults from there.

angular gen

Angular Gen Output

Awesome! Now I have an Angular Web project ready to go. Let’s open it in VSCode and start work. File -> Open Folder aaaannnd…

OpenFolder

Ready to work!

Next post we’ll do some work in VSCode… till then.

Narcissism in Numbers and My New Favorite Number: 8208

Sometimes maths is awesome. I’ve been catching up on the podcast The Infinite Monkey Cage. In one of the episodes they talk about number theory and specifically narcissistic numbers. My interest was peeked, so I had to write some quick code to prove out this theorem?? myself.

nar·cis·sism /ˈnärsəˌsizəm/ (noun) – excessive or erotic interest in oneself and one’s physical appearance.

A narcissistic number, as defined by Wikipedia here, as a number that is the sum of its own digits each raised to the power of the number of digits. So basically:

153 = 1^3 + 5^3 + 3^3 = 153

How can this not intrigue you?

function isNarcissisticNumber {
    param([int]$number)

    # Convert numbers to an array to work with each number and get a count of intergers
    $numbers = $number.ToString().ToCharArray()

    # A place to total up each individual integer
    $nar = 0

    # This is where the magic happens. We get the power equal to the length of the array
    # for each of the individual intagers then get the sum of all.
    foreach($num in $numbers) {
        $num = [char]::GetNumericValue($num)
        $nar += [math]::Pow($num, $numbers.Length)
    }

    # Simple check to see if the total of the individual numbers is the same as the
    # inital number.
    if ($nar -eq $number) {
        return $true
    }
    else {
        return $false
    }
}

1..10000 | foreach { if ( isNarcissisticNumber $_ ) { $_ } }

The output will look like this:

narcissisticnumbers

The Case of Azure Websites and Continuous Deployment

deployment2

TL;DR: Build a site to do wireless surveys: https://wlansurvey.azurewebsites.net/

So this post has a misleading title… Because I’m not going to explain how this works, Azure Websites continuous deployment is not anything really new, and also It’s well documented here and here.

Anyhow, the family and I recently moved into a new house. Our ISP was out today, running cables and getting things setup. Since I didn’t really know how well my wireless router was going to cover the house, I asked Nick the fella working on getting me back online, if he had the ability to do a wireless survey of my house.

Nick said, “Well they give us this Airport Utillity app on our phone. I can tell you what the db levels are, but I’m not really sure what they mean”.

Problem: This person should be able to tell me what my signal quality is, room by room.

Solution: Five minutes googling with bing lead me to a Stack Overflow post that sounded smart enough and even had math explaining how to go from dBm to Quality percentage. Time to deploy something to Azure.

Enter Azure Websites Continuous Deployment. While he finished up the house, I started writing some quick code, pushed to GitHub, and setup my website in Azure to deploy from… you guessed it GitHub.

At this point you maybe asking: “Pray tell, how did you deploy to Azure with no internet connectivity?”.

To that I say: “With my Verizon Jetpack, of course”.

By the time he was finished, I’d installed the Airport Utility app on my iPhone. Ran around the house gathering the dBm metrics for each room, and plugged them into: http://wlansurvey.azurewebsites.net.

He was a little shocked, but took down the web address and said he was going to tell all the guys at the office.

Awesome! Hope you all had a great weekend… I spent mine moving.

Get your Azure AD Tenant ID with PowerShell

I’ve been working with Azure AD authentication and GraphAPIs a lot lately. This is a short script I wrote to get your tenant ID…

 
param([string]$TenantName = (Read-Host "What is your tenant name? (example.onmicrosoft.com)")) 

1$data = (New-Object System.Net.WebClient).DownloadString("https://login.windows.net/$TenantName/FederationMetadata/2007-06/FederationMetadata.xml") 

$dirtyID = $data.EntityDescriptor.entityID.Replace("https://sts.windows.net/", "") 

$dirtyID.Replace("/", "") 

8 Azure Preview Features You Should Look At

PreviewFeatures

Azure… There is plenty to keep up with, just dealing with the features that have been released. With that in mind, have you enabled the preview features? Take a minute and go to your subscription account portal and have a look… https://account.windowsazure.com/PreviewFeatures

Azure Batch

Have an application or parts of an application that does processor intensive work? Hand it off to Azure Batch. Basically it pushes your code to a designated amount of VMs and processes the task in parallel.

More Info >>

Auditing for Azure SQL Database

Exactly what it sounds like… It logs events to an Azure Storage account. What are some of these events you might ask? I’m glad you did: Accessing data, Schema changes, data changes, accounts, roles, permissions, security exceptions. For a complete reference see the Audit Log Format Reference DOCX.

More Info >>

Operational Insights

Need to monitor a lot of machines? This is what Operational Insights is good at… Install an agent. It talks to Azure Operational Insights web service running in … well Azure. There is a portal where you can create all kinds of great looking dashboards and reports.

More Info >>

PlayReady License Server

So you run a live video feed of an event, or a video on demand service and you want to secure your content. You can with PlayReady. This is a token issuing service that allows a player to decrypt your video content. You should check this out if you’re doing anything with video… all the cool kids are using it, and it’s in my wheel house. Shoot me an email if you’d like to discuss more.

More Info >>

Azure Premium Storage

Premium Storage Disk Type P10 P20 P30
Disk size 128 GB 512 GB 1024 GB (1 TB)
IOPS per disk 500 2300 5000
Throughput per disk 100 MB 150 MB 200 MB

5000 IOPS per disk!.. Shut up and take my money!!

More Info >>

Stream Analytics

Real time data analytics allows you to analyze patterns in data streams or historical data before storing the events. Think… the backend to your IoT strategy. Not a lot of companies are thinking about their IoT strategy yet… but at Microsoft we are. This is why Gartner and other think-tanks are putting so much weight on data sciences in the coming future. You have been warned.

More Info >>

Windows Azure Files

For this you’ll run some PowerShell to create a file share in an Azure Storage account. VMs can then mount these as a network shares or you can access the share using the REST API, much like blob storage. Pretty sweet feature… one I’m using right now!

More Info >>

Billing Alert Service

If you’re the account administrator for your subscription, you can set an alert when you spend “X” amount of dollars. Not quite a billing API, but I configured a few alerts to let me know when I’ve spent different amounts of money.

More Info >>

Azure Web Sites DaaS–Diagnostics as a Service

image

 

DaaS for Azure Web Sites is a great tool when “bad things happen to a good site”! It allows you to collect a plethora of different logs and parses them into an easily digestible format. The idea is to enable you to get to root cause without turning to the forums or Microsoft support. I’m running a WordPress site that, knock on digital wood, is pretty rock solid. Even so, I’m going to use this site to play around.

Until the recent announcement, the collection and parsing of PHP logs wasn’t an option, but now DaaS will collect PHP specific files along with Event Logs, Memory Dumps and HTTP Logs. First you will need to enable Web Server Logging to the File System. With that down just browse over to https://<YourSiteName>.scm.azurewebsites.net/DaaS and you’ll get a page like this…

image

 

All you need to do is click Diagnose Now and your off to the races. Oh, and you can also schedule an analysis if you’d like…

Once that is complete you can download your logs at: https://<YourSiteName>.scm.azurewebsites.net/Zip/data/DaaS.