What the heck is Kudu? – you may ask. Well, if you are running web site(s) on Windows Azure, you should read on and learn how you can not only leverage Kudu but also how to integrate it in your workflow using Royal TS. Even if you do not use Windows Azure web sites, you might still find the blog post interesting as it demonstrates some powerful features of Royal TS.
Scott Hanselman blogged about how easy you can see Trace output of Windows Azure hosted Websites here. I’ve blogged about the backend that is making all this work: Project Kudu. Project Kudu is an open source project from Microsoft that is the backend of their Git deployment of Azure Websites. It’s very easy to integrate this in your Royal TS workflow and have Kudu at your fingertips…
Since you need to authenticate to the Kudu page, we will first prepare a Credential:
For the Kudu project URL you need to use the following URL scheme: https://<your-website-name>.scm.azurewebsites.net/
So let’s create a new web page with the URL:
Now, let’s assign our previously created credential to the web page:
Next, click on Advanced. Its important that you specify to use Basic Authentication for this:
And here you go! 🙂
From there you can monitor the log stream (diagnostic log stream) or open the diagnostic console:
If you have many Azure web sites, you probably don’t want to define a new Web Page for each Kudu page. Assuming that your Azure web sites are already configured in Royal TS, you can use custom fields to store the Kudu page address for each Azure web site. Then, just create a Template which opens the Kudu project page based on that custom field.
For this we need to store the Project Kudu URL in a Custom Field in your Web Page Connections:
Remark: Note that the “Custom Field 1” was renamed to “Kudu Project Page” – you can do this easily through editing the Default settings:
Then, you create a Web Page Template. To do this, go to the Ribbon Tab “Edit” -> “Add New Template” -> “Web Page“.
Define $CustomField1$ as URL and to make sure configure the same settings as shown in the first section (Credential, Basic Authentication):
After this, you can connect to every Azure-hosted Web site via this template and directly go to the Kudu Project site.
The Azure log stream is a very helpful tool to diagnose issues with your web site. Developers can easily write to the log stream from within their application. You can also directly connect to the Azure Logstream via curl (or similar command line tools), in my case something like this:
curl -u sargola_deploy https://azurelogstreaming.scm.azurewebsites.net/logstream -k
If you execute the curl command, you will be prompted to enter the password. Using Key Sequence Tasks in Royal TS you can still fully automate executing curl end even let Royal TS enter the password for you.
Let’s define a Key Sequence Task:
Via the “Edit” Ribbon Tab and add a “Key Sequence Task” you specify it like this:
Then add an External Application:
Command: cmd.exe
Arguments: /k "[PATH-TO-CURL] curl.exe –u $EffectiveUsername$ https://[websitename].scm.azurewebsites.net/logstream –k"
Also make sure you assign the credential (we prepared in the first section) to the External Application!
Then reference this Key Sequence Task in your External Application:
And now you get any trace-messages from your Web site directly in this command line:
I was unable to find any limitations of the log stream feature besides the information Scott Hanselman mentioned in his blog:
– Tracing is turned on for 12 hours – You can and should specify the log settings (log files, names, sizes, etc.)
We get numerous feature request that point in the direction of having a second/custom dashboard functionality based on an URL that is based on some connection property (like the host name). In the next major release we have a couple of improvements and enhancements on the roadmap which will further simplify your daily work for scenarios like this.
cheers,
Michael