5 Minutes with Kibana – Overview Dashboard

Let’s create some data visualizations using Kibana. Kibana is the “K” in the ELK stack. The ELK stack stands for:

  • Elastic Search
  • Logstash
  • Kibana

I have a Windows Server running in Azure that is has an instance of Elastic Search and Logstash setup. Logstash is configured to send tweets from twitter containing Microsoft Azure and Windows 10 topics to Elastic Search.

In this 5 minute short, we’ll setup up an overview dashboard that gives us an idea of what people are talking about on twitter.

Deploying Azure Resource Manager Virtual Machines with Visual Studio for IT Pros

While PowerShell alone is great for deploying Azure Virtual Machines, the newest innovations in Visual Studio make PowerShell plus Azure even easier! Join Tommy Patterson and I as we walk through the process of setting up Visual Studio with an Azure subscription, editing the scripts in the traditional PowerShell ISE then moving over to showing how this can be done much easier with the latest Visual Studio enhancements! The latest innovation with Azure Resource Templates plus Visual Studio make multi-machine deployments so much easier. Visual Studio is not just for developers anymore!

Authenticate to the Azure Service Management API

So, back in the day we used x509 Certificates to authenticate to Azure’s API. A year or so ago, Azure Active Directory became the defacto method of authentication. MSDN talks about it in the article: Authenticating Azure Resource Manager requests. From the article:

All of the tasks that you do on resources using the Azure Resource Manager must be authenticated with Azure Active Directory. The easiest way to do this is to use PowerShell or Azure CLI. If you don’t have access to PowerShell or Azure CLI, use the Azure Management Portal to set up authentication.

So yea… this isn’t necessarily true. I worked with a couple of folks from support engineering to use the common authentication endpoint, so that you don’t have to setup an application in Azure Active Directory and provide an application id.

I posted the code up to GitHub here: devdash/EzAzureMgmtApiAuth.

*Note: I can’t claim this is supported in anyway… but it works great and has since the beginning.

The App

Basically it’s a console app that asks you to login using your Azure credentials, asks you which subscription you’d like to use if you have more than one, and then finally prints out the choice you made. Simple, but I think powerful.

The Code

If you’re anything like me, you’ll open Git Shell and run:

git clone https://github.com/devdash/EzAzureMgmtApiAuth.git

Then open the SLN:

C:\src\gh\EzAzureMgmtApiAuth [master]> .\AzureRestPlayground.sln

Now normally once I have the solution open in Visual Studio and I see that it’s a console app I start looking at: Program.cs. Below is the relevant code, the code that kicks off the authentication process…

static void Main(string[] args)
{
     var azSubs = new AzureSubscriptions();
     var subList = azSubs.GetSubscriptionList();

     ...
}

This code isn’t rocket science. It initializes an object of type AzureSubscriptions and calls the method GetSubscriptionList. Let’s go have a look at this method, particularly the second line:

string token = AuthHelper.GetAuthorizationHeader();

Off to look at the AuthHelper class and it’s static method GetAuthorizationHeader

public static string GetAuthorizationHeader()
{
     AuthenticationResult result = null;

     var context = new AuthenticationContext("https://login.windows.net/common"); // tenant agnostic endpooint
     result = context.AcquireToken("https://management.core.windows.net/",
                                   "1950a258-227b-4e31-a9cf-717495945fc2", // Windows Azure Management API's Client ID
                                   new Uri("urn:ietf:wg:oauth:2.0:oob")); // standard redirect for native apps (console, desktop, mobile, etc)

     if (result == null)
     {
         throw new InvalidOperationException("Failed to obtain the JWT token");
     }

     return result.AccessToken;
}

And here finally we se some good stuff. We got all this good ness by pulling in the ADAL nuget package and writing a couple of lines of code. We pulled the “Client ID” being passed to the AcquireToken method using fiddler and tracing a “promoted” app and borrowing it’s ID. This is why my note above states that this probably isn’t supported. From here we are returned a token. We construct our Auth Header in the HttpHelper class using this line of code:

request.Headers.Add(HttpRequestHeader.Authorization, "Bearer " + token);

Well that’s that. Using the ADAL library and a common auth endpoint. Now any app can authenticate to any subscriptions service management API given the right credentials. Awesome!!

Post to Slack from PowerShell

I was working on some reporting/alerting from my deployment and monitoring systems. I want them to talk to me on slack. A lot of the work is done in PowerShell so natrually this is some PoSh code I need… Anyhow I wanted to share…

First you will need to enable Slackbot remote communications. I just went into my teams Intergrations and added Slackbot. This will generate a URI with a token. Copy that and keep it handy. Here is the simple script to post as Slackbot.

$slackbotUrl = "https://MYSLACKNAME.slack.com/services/hooks/slackbot?token=xxxxxxxxxxxxxxxxxxxxxxxxx"
$channelParam = "&channel=%23general" # %23 is the # sign
$postUrl = $slackbotUrl + $channelParam
$message = "Another Post to Slackbot..."

Invoke-WebRequest -Uri $postUrl -Body $message -Method Post

Cloud, Azure, DevOps, Love and Hate

Early in 2007 or 2008, the one and only, DigUnix got back from an overnight hack-a-thon. During this thon he was introduced to running Linux boxes in Amazon’s datacenters. Till then, he and I used to just remotely build Gentoo boxes from across the hall and get in trouble for scream profanity in the office. Hey we worked with Linux… it’s what you do. This is when I was introduced to AWS and my love for the “cloud” was born. Of Couse this is before we called it the cloud.

Later in 2011 I was on my way to one of the Atlanta PFE team meetings we hold at the Alpharetta Office once a month. I’d carpooled that day with another PFE, because we recently discovered that we lived close to one another. What I didn’t know was this man would change my life for the foreseeable future. During this car ride he started telling me about this thing called Windows Azure… I promptly forced him to immediately create me an account when we got to the office. A year later I was giving talks about automated deployments to Azure, but I get a head of myself.

This was a time when the Silverlight portal was all the hotness and our biggest selling point. Yea, so we’ve come a long way and that’s all I have to say about that. These are the days before IaaS or Azure AD. We used ACS to authenticate cloud apps and life was setup hell. Still it laid a framework for building great things. I’ve worked for, and with, many of the Azure Product Groups over the years. I’ve had source code access to Reddog, and helped build telemetry systems customers use for their feedback loops. It’s been a great and busy ride. Through it all I kept saying that I was going to put up some good content and share some of my learning here, but alas I never got beyond small tidbits of things I wanted to remember… till now.

I will start with DevOps.

I’m not a fanatic, this is the only way to solve world hunger, DevOps practitioner. I’ve worked with cloud providers, ISVs, Partners, and IT shops alike exploring this world. I’ve seen some of what works and some of what doesn’t. I was skeptical about the whole culture thing, and transformed into a believer. I have a skewed view toward .Net Apps and Azure. You’ve been warned!

Let’s start with life cycle, and this will set the stage for the rest of what I plan on talking about.

  • Develop
  • Build
  • Test
  • Deploy
  • Configure
  • Monitor

This is where my framework will start. I’m going to talk about each item listed above in hopefully one post each. I plan on sharing not only tools and practices I’ve found that work, but also some of the cultural hurtles I’ve seen. I’m creating a repo that will house demos and other goodies needed to make this work. It should be a complete deployment of some sort of app/system that demonstrates most if not all the aspects needed to be successful using the Microsoft Stack in Azure. Beyond that… I don’t really care. Deal with it.

Automation is king. I’ve made the joke with my customers over the years, automate everything so you can pretend to work and play video games. It’s not a joke. Let’s get started…

Changes to Windows 10 Preview – Insider Hub

Win10TechPreview

I use this tool to say up-to-date with what’s going on in Windows 10. The most recent announcement stated that this is not going to be installed going forward. It also lists how to get it back, so for posterity sake I’d like to post it here to remember. From the announcement…

Insider Hub & Windows Feedback app

Because we’re getting ready for the final release, we’re removing a few things we don’t expect to ship to everyone. So starting with the next build, the Insider Hub will no longer be pre-installed. Windows Insiders can reinstall the Insider Hub app through the following steps:

  • Go to Settings, System, Apps & features
  • Click Manage optional features then Add a feature
  • Select the Insider Hub entry (the list is in alphabetical order) and click Install.

You will have to go through this process with each build we flight prior to the final release on July 29th, but once we start flighting new builds after July 29th it will be preinstalled again.
The Windows Feedback app will continue to be included in builds and in the final release. But as I noted above, the Windows Feedback app will have functionality specific to Windows Insiders who are registered for the program with their MSA connected to their PC.

I Have a New Role at Microsoft

So, I was a Primer Field Engineer, but now I’m a Technology Evangelist. What’s up with this move? Yes I have a very technical skillset in development and cloud technologies. I’ve worked on some of the largest projects and with some of the toughest customers. I’ve been very fortunate to get to do awesome work over the past five years as a PFE. Now it’s time to share my learnings and pay it forward… at least for a while.

I have a simple plan, be genuine. It’s worked really well for me working with customers in a more intimate atmosphere, but I suspect it will serve me well as I continue my journey in this new role. In this new role, I’ll be working with the community in Atlanta, hanging out at places like the Atlanta Tech Village working with startups, and creating content for Channel 9. I’m only a couple weeks into the role, but so far it’s kind of exciting.

I have been thinking of how to best share and I think some practical and impractical projects will be best, so I’m working on two projects as of now:

Kinect Driver for Azure – This will be used to off load processing of the Kinect data streams to Azure… Think IoT.

Azure DevOps Toolkit – This will demonstrate various roadmaps that one can use to deploy and monitor apps in Azure… Think 10 deploys a day.

I’m still prototyping these out, but expect to see some content relating to these in the coming months. So yea, let’s get started!

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!