the next door (so called) geek

@rakkimk | your next door geek | friend | blogs mostly on technology, and gadgets.

Learning Azure Service Management REST API through Powershell, and Azure CLI tools

Azure Service Management REST API is used by all the public tools provided by Microsoft to manage your Azure Subscription – Portal, New Portal, Powershell, X-Plat CLI. You can use the same APIs to build your own tools that would manage your Azure Subscription. Sometimes, it is little difficult to bring up all the necessary information needed to be passed on to the REST API call. MSDN documentation of all these REST APIs has all the information that you need. And, there are sometimes, you might need more help.

Read the complete post in my team blog.

Unable to setup AutoScale for Virtual Machines from the Azure Management Portal

You can set up AutoScale for your Cloud Services, Virtual Machines, Web Sites from the Azure Management Portal. For Virtual Machines, autoscale can be configured for each availability set. You can setup AutoScale for your availability set only if:

  • You have only ‘Standard’ VMs in your Availability Set. Basic VMs cannot participate in AutoScaling.
  • Your ‘Standard’ VMS are of same size.

………………….

I just posted a new blog in my new team’s MSDN blog. Read the complete post here.

Stay updated on Microsoft Azure - blogs, service status, news

Everyone wants to know what’s happening on their area of interest. Being up to date is a necessity in this new world of Cloud Computing, where you see various things happening every minute, new services getting released, old services getting updated with incremental changes, announcements, price reductions, and whole a lot more. I’ll try to list down a few ways in which you could be stay updated on various things around Microsoft Azure Platform.

Blogs for Microsoft Azure

I’m pretty sure I’m missing many other blogs. If you have any other in your list, post it via the comments below. I’ll update the post. How are you going to read these blogs is up to you. I personally subscribe to all of them in my favorite RSS reader application, NextGen Reader available for both Windows and Windows Phone. Of course, if you aren’t aware, your favorite email client, Office Outlook could do for your subscriptions too. You could also like Microsoft Azure on Facebook to see the updates in your FB feed.

Videos on Microsoft Azure

Azure Friday, and Tuesdays with Corey are certainly my favorites. You could subscribe it as an RSS feed too, or in any of your favorite podcasts application. Did I say that I watch a few of these in my TV? Yes, I did.

What are your feedback channels?

The awesome product is always in the making. Products gets better with the community feedback. Microsoft Azure has the general feedback site where you could submit your feedbacks. I’m pretty sure various teams at Microsoft looks, and act on these feedbacks.

Of course, various folks are in Twitter. While not an official channel, you have a great chance to be updated on their online updates, a few related to technology, I should warn you ;) Find them yourself, and follow. I do follow a lot of people. David Ebbo, Azure Websites Development Lead has created this twitter list of people from Websites team. You could subscribe to the list too. You could also search for #azure in Twitter lists to see more of those.

Where can you seek help on Microsoft Azure?

For online forum support from the experts, you could always reach out to sites like StackOverflow, or MSDN Forums. While not an official site, here is one which you could use to see the various features and their support status. For Azure Support Options, you can see your options here. Depending on the support plan that you choose, you could get a support person like me directly to talk to you over phone/email to answer your questions, solve your technical problems, help you with migrating your applications to Microsoft Azure. Let me know if you need any help in running your applications in Microsoft Azure! @rakkimk is my twitter handle if you want to send me a quick tweet.

Alright! Stay updated. Dance now :-)

What are your options to host your web application with Microsoft Azure?

Microsoft Azure is growing. All it’s services are getting huge adoption. Currently, there are 3 types of Microsoft Azure services that our customers can use to host their web applications.

    1. Hosting your web application inside IIS, from Azure Virtual Machine.
    2. Hosting as a Web Role using Cloud Services.
    3. Hosting as a Azure Website.

I’ve tried all the above for my personal hosting needs, and I thought of putting this little page that might lists most (but not all) features associated with each service, and what you can do. I’m not going to suggest you which one to use for your hosting needs, because all these 3 offerings are created for specific set of customers with specific set of needs. Depending on how much you want to pay, versus how much control that you need, you could select one of these. Here is one more blog which does comparison of features available.

Hosting your web application inside IIS, from Azure Virtual Machines

This service offering gives you all the power that you had with your on-premises deployments. You own the VM, so you do own the updates to the VM as well. You manage the host names inside IIS, you have to setup the host header within IIS, just like you do in your on-premises hosting. It’s your box. Anything that runs perfectly in your corporate server, it should run here. So, if you have any additional software that you need to install, and manage the updates to the Operating System yourself, this is it! Go for it. At the time of writing, a standard Medium VM instance (2 x 1.6GHz CPU, 3.5GB RAM, 490GB Storage) will cost you $0.18/hr, or $133.92/month.

Hosting as a Web Role using Cloud Services

Hosting as a web-role, cloud service saves you from managing the Operating System updates. Still, you own the application – you could RDP to the VMs, and perform anything that you might do in an on-premises server, only thing to remember is these are stateless Virtual Machines allocated to you. So if you stop, and start your deployment, you might be allocated a different VM, and so on. Here, you own the code, application updates, etc, but leaving the OS updates to Microsoft. At the time of writing, the same standard Medium VM instance (2 x 1.6GHz CPU, 3.5GB RAM, 490GB Storage) will cost you $0.16/hr, or $119.04/month.

Hosting as a Azure Website

Azure Websites is another one way that you could host your websites with Microsoft Azure. It is so far the easiest way to host the websites, and you don’t have to worry about the Operating System updates. To some extent, you also need not to worry about your Application Updates, since there are ways to connect your application deployment to your source control, or even Dropbox folder that will sync to the production. It has one click swap to production vs staging slots, and many more cool features. The newest WebJobs adds more background processing power to your websites. It’s like adding a new Worker Role to your existing Cloud Services offering, only that adding WebJobs doesn’t cost you anything extra since that runs in the same machine as your website. At the time of writing, the same standard Medium VM instance (2 x 1.6GHz CPU, 3.5GB RAM) will cost you $0.20/hr, or $148.80/month.

For all your pricing related queries, try this page in the official site. There are various tier offerings that you should take a look, which would match your needs, and the budget.

Hope this helps!

Auto Install IIS in the Microsoft Azure VM that you are creating

The world is moving fast, actually faster! You too want to do things faster, right? Why wait until the VM is created, provisioned, available over RDP, login, etc to do a few initial stuff. Of course, you can upload your custom VM image, and bring up a Virtual Machine from the image, but few times you may also want to do it afresh.

In TechEd 2014, Scott announced a lot of updates to Microsoft Azure. One of my favorite is the ability to run custom scripts on VM creation. Yeah, it’s more like your startup scripts that you are used to, but trust me, you will save a lot of times in doing a few repetitive things that you might want to do with your deployments.

To do this, first write a simple powershell script to install the IIS role (along with what all features you might want to have), and save it as a ps1 file in the local disk, or you can upload to your Azure Storage, and pull it from there. The later step is better, so that you don’t need to rely on the local disk to have your scripts repository.

In my case, I just had the below command in my install.ps1 script file:

Add-WindowsFeature Web-Server –IncludeAllSubFeature

This installs all the sub features under the Web-Server. Security Statement : You should choose to install only those that you need, so that you reduce the surface area for the updates/attacks. Now, using this script is just simple from the Portal. You can choose to install the VM agent first, and then choose the “Custom Script” option, and choose the file that has the installation scripts. Here, you can be fancy. You can do all your other configuration stuff like opening firewall ports, changing website path, etc. It’s your VM. You own it!

image

Hope this helps! I’ll try to work on a few useful powershell scripts for your web-server scenario, and post it later. Keep coming!

Microsoft Azure. Rock on.

Azure Websites SCM site updated to have Single Sign-on

If you haven’t noticed, your Azure Website’s SCM site has been updated to work with Azure Single Sign-on. Earlier, it was prompting for a basic authentication prompt where you enter your publishing credentials, but now, you can just login using your Microsoft Account which you are using for your Azure Subscription.

For example, if I go to my site https://<mysite>.scm.azurewebsites.net, it shows me the below:

image

If I’m already logged into my Microsoft Account, say, I’m already on the Azure Management Portal, I don’t even see this if I’m going to the SCM site. It takes directly into the SCM site. However, in case if you need the basic authentication, you can append /basicauth in the url, like https://<yourwebsite>.scm.azurewebsites.net/basicauth to get the basic authentication prompt.

Azure Websites – Viewing Site Configuration files from Kudu

Azure Websites Paas offering from Microsoft gives you more power to you. You could change a few default configurations that come with the platform by various means, for example, for PHP you can set a few settings in .user.ini, for any custom values for ApplicationHost.config, you can use XDT transforms. There are a lot of times, you want to check what are the default configuration files that are used for your Azure Website. You could easily get those files from the Kudu Console. To access the Kudu Console, navigate to https://yoursite.scm.azurewebsites.net, and login with your deployment credentials.

Once you are in the site, click on “Debug console” menu, and choose “CMD”, or Powershell. Both should open a file explorer, and a console window below. From the file explorer, you can click on the “Site Root” icon, the middle one, and then click on the “Config” folder.

image

This is the hidden place (well, not anymore) where you will find all the configuration files related to your website instance. So, you have there your applicatiohhost.config file, the rootweb.config file, and also the PHP.ini files for various PHP versions available for the website.

You could either view the file right there by clicking on the could download the file by clicking on the clip_image004 icon. Ofcourse, the below console you see there is powerful too. You could try your favorite command line utility in there. For example, I want to print out the last 10 lines of the configuration file.

image

And, yes, you can edit a few files right from this Kudu as well.

Well, you get the point! Have fun.

Kudu for Azure Websites updated with ‘Process Explorer’ tab

I’m sure everyone appreciates the pace in which Azure Websites team releasing cool features. Azure Websites was all over the announcements in the recent //build. The team has updated the Kudu console with new tab named ‘Process Explorer’. You will see it in the list of options available in the site. To access the Kudu console, go to https://yourwebsite.scm.azurewebsites.net (note the https, and .scm in the url).

image

If you have used the Kudu console before, you would have seen there are REST APIs available for a lot of things, including “Processes and mini-dumps” which when used in Google Chrome with JSON viewer extension was easier to use to get mini dumps of the w3wp.exe process, or getting a gcdump of the process. This new “Process Explorer” tab gives you a cool UI way of doing the same.

image

It will list down all your running processes, under your site’s context – including the w3wp.exe that serves your main website (as well as this Kudu site, or any other site extensions like Monaco editor), any WebJobs your site might have, even the cmd.exe/powershell.exe that gets launched when I open the debug console. You could easily see things like, the memory usage of the process, how many threads are there, handles within the process, and more.

image

Getting memory dumps of the worker process was one of the main post mortem debugging techniques we often do in Microsoft Support while helping the customers with their common issues like hang, slow response, memory leak. Good to see this easy way to get dumps from the Kudu console.

Happy Debugging!

Site Extension Gallery in Windows Azure Websites

I’m no ScottGu, or Scott Hanselman, but I had my own privilege to introduce the Site Extensions gallery to the world during my talk on ‘Deepdive with Windows Azure Websites’ along with Puneet at India’s First ever Windows Azure Conference, Bangalore, March 20, 21st. David Ebbo was kind enough to let me do this. Watch out for his blog/twitter for more updates on this in the coming days. This gallery is part of your Kudu console of the Windows Azure Website. It’s like Nuget for Site Extensions. This should provide an amazing opportunities to people with diagnostics products, or helper console for Websites to get people use it with Azure Websites. Needless to say, you will hear more about this soon, but for now, it is how it appears.

image

There are only a few available right now, but I’m sure this list is going to grow. By the way, this feature is live! So, login to your SCM site of your Windows Azure Websites, and you will see a new option in the top bar, ‘Site Extensions’. You can install a Site Extension listed there by just clicking on “Install”. Once you have installed it, you have to restart the site to make it functional. You have a “Restart Site” button in the top. You also will see this new one that you installed in the “Installed” tab. From there, you can click on the “Launch” button to see the new Site Extension that you installed for your site in action. The Azure Storage Explorer site extension is really cool.

I’m sure I will write more about this sooner. Come back again later. You can follow me on Twitter for quick updates.

WAWS - WebJob to upload FREB files to Azure Storage using the WebJobs SDK

After writing my earlier post on creating a simple WebJob to upload the Failed Request Tracing logs automatically to Windows Azure Blob Storage account, I was discussing this with the awesome development team of the WebJob SDK, Amit Apple, and Mike Stall. And, the outcome is, getting my sample modified to use the awesome WebJobs SDK that eases a lot of tasks. And there is more to it – cool Azure Jobs Dashboard with your Windows Azure Web sites giving you a cool dashboard of your WebJobs messages getting processed.

With the WebJobs SDK, there is automatic way of calling certain functions. You can check Scott’s blog where he have used a function that just monitors his Azure Blob Storage account for an new blob to be created, and process that image, and push it to his Azure Blob Storage account itself. The code he has written is very less, just one function, and wrapping that inside an application with the WebJobs SDK. If you notice his function, he used attributes [BlobInput], and [BlobOutput]. However, in my case, for the example that I was trying – to push the files from file system to the Azure Blob storage, I need some thing like [FileInput] which isn’t available, but WebJobs SDK seems to give custom ways to hook in functions to help with the interaction with the Azure Blob Storage account. I’ve modified my function that uploads the file as below. I also call this Upload function from another function.

        public static void Upload(string name, string path, // Local file 
                                    [BlobOutput("freblogs/{name}")] Stream output,
                                    bool deleteAfterUpload)
        {
            using (var fileStream = System.IO.File.OpenRead(path))
            {
                fileStream.CopyTo(output);
            }
 
            if (deleteAfterUpload)
            {
                File.Delete(path);
            }
        }
        public void UploadFileToBlob(string name, string path)
        {
            var method = typeof(AzureStorageHelper).GetMethod("Upload");
            _host.Call(method, new { name = name, path = path, deleteAfterUpload = deleteAfterUpload });
        }

If you notice, from the UploadFileToBlob() which I’m calling from my FileSystemWatcher callback, I’m not doing any single bit of code to upload the blob to the Azure Blob Storage, I just call another function via the _host (of type Jobhost), and pass the parameter name, path, and the boolean, WebJobs SDK function automatically fills in the Stream output there which would be created as a blob under the “freblogs” container, with the same name that I pass into this function, “name”. You just need to configure the connection string with name “AzureJobsData” for the application in it’s app.config file. Pretty awesome, isn’t it? This WebJobs SDK is in alpha I’m told, so I’m really waiting to see what are the new features in the final version. Sure, the team has set a high bar for themselves Smile

If this isn’t enough, you have an awesome site extension for your Azure Websites that shows all these WebJobs operations with the Azure Blob Storage. I was trying to understand how this works, what WebJobs SDK does is, create another container called “azure-jobs-invoke-log” in your Blob storage account, and stores the logs inside, which then are fetched by the AzureJobs site extension, and shown to you. Here is what my Storage Account shows the containers, the “freblogs” that contain all the FREB files, and the “azure-jobs-invoke-log” showing the container that holds all the log messages of WebJobs SDK.

image

And, to enable the Site Extension, you need to make sure you first configure the connection string named “AzureJobsRuntime” having the same connection string to the Blob Container.

image

After saving this connecting string, then you have to go to the URL https://<yoursitename>.scm.azurewebsites.net/AzureJobs URL. This page shows you details about your WebJobs configured on the Blob Storage account that you have configured, and it’s full details. You can click on each invocation to see it’s details. Remember, in my case it is a custom function that I’m invoking, so it will show you all the details about the parameters that were passed in, and the result of that call. Also, it has a link to the file that we just uploaded – you can download that file by just clicking on the output hyperlink in the 2nd screenshot below.

image

image

Pretty awesome! Don’t wait. Add more power, and background processing to your Azure Websites using the new WebJobs SDK.