Starting Azure Platform as a Service (PaaS) Development 101 Series: Lesson 1 of n – Web Jobs

There is a lot of content available to develop for Azure, if you are looking for baby steps this series of lessons is defiantly not for you. However, if you are developer, regardless of background or platform and looking quickly to get your hands dirty, then you are at the right place. I will not be setting up a fixed or target number of lessons, I will share ideas along the way and keep adding more. This does not mean I don’t have an agenda, on the contrary! I started by asking myself about developer tasks during the life cycle of building a PaaS solution on Azure.

As I mentioned earlier, this a special series that focuses on a point, a task, a recipe. So don’t be surprised if we wont be building fancy samples, I am here to help you get on your feet with PaaS development on Azure.

What’s up for today?

I’ve been doing Azure PaaS development for a while now, and I can tell you that the best place to start learning the robes are Web Jobs. Let me quiz you quickly here: What would you do if you want to run background tasks, executable files, or even scripts on Azure? I bet you would say: let’s spin a new VM and put all that stuff there. Or at least that’s what we used to say before Web Jobs came to life. So in a nutshell, you can schedule and configure on demand executable applications and scripts to run on Azure without spinning a new VM Winking smile 

Let’s get cracking

Below is a simple command line application that will print a time stamp. We will create a Web Job and configure it to run this application every one minute. Yeah I know a bit cheesy, but hey if you can come up with more meaningful examples, fire up the comments section below Hot smile

1 using System; 2 3 namespace PaaS101.Lesson1 4 { 5 class Program 6 { 7 static void Main(string[] args) 8 { 9 Console.WriteLine(DateTime.Now); 10 } 11 } 12 }

Launch the Azure portal and head to Web Sites. Yep that’s right, Web Jobs sit inside Azure Websites and yes you can have multiple web jobs in the same Azure Website. Let’s create a new Website. I will use the same website through all the lessons. I called it paas101 and it will sit on http://paas101.azurewebsites.net.

image

Once created, click on paas101, select WEBJOBS tab, and create a new job.

image

Now you will have to compress your executable and their dependencies in one zip file. Since we decided to run it every minute then select “Run on a schedule” and choose your schedule region. Mine is “West Europe”.

image

Moving on to the next step, select “Recurring Job” for recurrence and set it for one minute. Looks like you have to specify and ending time. I just set it to 11:30PM today my time.

image

Once its done, you will notice that the status is set to “Enabled”. Let’s see how was the execution of our Web Job going. One of the columns is called “LOGS”. Navigate to the URL.

image

This is the logs URL for our Web Job: https://paas101.scm.azurewebsites.net/azurejobs/#/jobs/triggered/PrintTimeEveryOneMinute. Once you land on the logs page you will notice the previous runs below marked with a status:

image

Clicking on the web job will open the Web Job run details. As you can see from the screenshot below, the web job did print the time Smile

image

I hope you enjoyed the quick 101. Let me know if you have any questions or comments. Until next lesson Smile

Have you heard of the EPM Framework?

EPM stands for Enterprise Policy Management, and it’s a framework designed with the objective of allowing a scalable use of PBM (Policy Based Management) feature. Also, I’m writing this post because the EPM Framework was just updated to v4.

Sometimes overlooked, PBM is an excellent tool for any DBA to keep track of any standards and policies enforcement in the SQL Server environment. While it was introduced back in SQL Server 2008, even in SQL Server 2014 it’s implementation is part of the product.

SQL Server has several default policies you can import, your own needs will dictate what policies you want to create for your SQL Server environment, and report on those. You may want to enforce a certain standard in object naming, or you may want to know when any sp_configure option has changed from what you deemed the standard in your environment, just to name a couple of examples. There’s little you can’t do with PBM – do keep in mind it’s NOT a monitoring solution, but rather an auditing solution (not to be confused with security auditing or the CDC feature, which have different goals).

A couple remarks usually come up when talking about PBM:

  • I still have some SQL Server 2000 and 2005 in my environment, so PBM is limited for me.
  • I have 300 SQL Server instances in my company, so PBM is not easy to use in my case.

If you’re still with me, that is why the EPM Framework came to be by the hand of Lara Rubbelke (Twitter | Blog) – aiming to extend PBM usage to SQL Server versions 2000 and 2005, as well as ease the task of using PBM in a large enterprise in a way that PBM itself wouldn’t be yet another task that the DBA has to handle in the many servers in the environment.

EPM Framework v4 is tested from SQL Server 2000 to 2014, and includes the following updates:

  • For enhanced support of large environments:
    • Reviewed database design, including views and indexing
    • Redesigned data load procedure
  • PowerShell execution now deletes XML files as soon as load is done – improves space usage on temp folder
  • Redesigned reports

Note that an upgrade script for all the relevant database objects is provided, supporting direct upgrade from v3. Please check the documentation for further information.

Please give this new version of EPM Framework a spin and let us know what you think.

We are also providing a set of scripts as an extension to the base set of Microsoft provided policies, and assumes the user has previously imported these Microsoft provided policies, as described by the “Configure/Create Policies and Centralize on the Central Management Server” section of the EPM Configuration Documentation. These extra policies include:

  • Determining the if SQL Server instances are at the recommended SP level. Note that the condition has to be updated with proper build numbers for the policy to be current.
  • Determining the if SQL Server instances are at the recommended CU or Hotfix. Note that the condition has to be updated with proper build numbers for the policy to be current.
  • Do I have log backups older than 24h?
  • Do I have full backups on read-write, full RM databases?
  • The Service accounts must not match between the several services, so what is the current status?
  • Is AutoUpdateStats Disabled and AutoUpdateStats Async Enabled? Using SSMS gives you no warning if you’ve enabled this scenario, but if you think you are using AutoUpdateStats Async, guess again.
  • Check for database status that prevent database access, like Emergency mode or Suspect.
  • Are there Non-unique clustered indexes? This might be something you wouldn’t want as a rule-of thumb.
  • Are there tables with non-clustered IXs but no clustered IX? This might hint you to evaluate your application query activity against heaps.
  • Do I have log growth in percentage, and it’s already over 1GB?
  • Do I have more VLFs than my rule-of-thumb? This has a 100 VLF threshold – change as appropriate.
  • Am I using Enterprise SKU features? Maybe I need to move a database to another server, and if it’s not an Enterprise Edition, so I must account for this?
  • Is Maximum Server Memory set at default? You will want to set this setting different from default.
  • Is Server Memory set at a fixed value?
  • Are DB Compatibility levels same as engine version?
  • Is Tempdb number of files appropriate? Regarding number of schedulers and if is multiple of 4?
  • Do TempDB data file sizes match?
  • Is MaxDOP setting at the recommended value?

Can’t end without directing you to the now retired SQL Server PBM blog, which has some good info around the PBM feature that you must check out. Also, and older but still current whitepaper “Enterprise Policy Management Framework with SQL Server 2008” is available, and I recommend you read it to fully understand how you can use PBM with EPM to unlock PBM potential in your enterprise.

ASP .NET Authentication : OWIN middleware component for browser based sign-on using WsFederation

Authentication of ASP .NET Web API using OWIN middleware component with Azure active Directory is made so easy which we all know. For the matter of fact, the Visual studio integration  to choose different types of authentication during the creation of Web API made developers life easy compared to the previous ways of  onboarding Authentication through identity tooling[I'm sure we all remember the huge web.config :) ] . The  new OWIN-based programming model for securing modern ASP.NET applications simply changes the way in which developers think about claim based identity and its integration with their web application.

OWIN components allow you to secure your ASP.NET applications with Windows Azure AD, ADFS and any other identity provider supporting WS-Federation.

Microsoft OWIN components has been explained in great detail in the article and  to those who feel OWIN is new can definitely refer to this.  Btw, to those who want to read about _OWIN specification_ I would recommend reading  http://owin.org/  which has all the wealth of information about OWIN[Open Web Interface for .NET ].

Today to secure our ASP .NET web application that is integrated with Visual Studio we follow a simple initialization logic  with a simple code,  we can read about the flow  here.

The default project today when we create from Visual studio has the following piece of code;

 1: public partial class Startup

 2:     {

 3:         // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864

 4:        public void ConfigureAuth(IAppBuilder app)

 5:         {

 6:             app.UseWindowsAzureActiveDirectoryBearerAuthentication(

 7:                 new WindowsAzureActiveDirectoryBearerAuthenticationOptions

 8:                 {

 9:                     Audience = ConfigurationManager.AppSettings["ida:Audience"],

 10:                      Tenant = ConfigurationManager.AppSettings["ida:Tenant"]

 11:                 });

 12:         }

 13:     }

The audience and the Tenant information is pulled from the configuration and that’s it.. All of it is wired. There are is a lot of configuration that has been reduced and I’m sure people who have been working on the identity integration with the earlier approaches will definitely appreciate the work by  Windows Azure Active Directory team, Kudos to them :).

There was a question that came to me during discuss with my friends on how we can enable browser based sign on having to work seamlessly with the OWIN middleware and I though while I answer his question, can quickly post it  here as well, as this might help others who are looking for the same …

Coming straight to the Point, Microsoft.Owin.Security.WsFederation  Nuget does the magic of how we can have browser based sign on.. For us to have this one to our project, we need to add the below snip of code into ConfigureAuth method of the Startup class ;

 1: app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); 

 2:  

 3:              app.UseCoolieAuthentication(new CookieAuthenticationDefaultsOptions()); 

 4:  

 5:              app.UseWsFederationAuthentication(  

 6:               new WsFederationAuthenticationOptions

 7:  

 8:                 {

 9:  

 10:         Wtrealm = "<specific your realm>",

 11:         MetadataAddress = "Tenant of which you what to authentication the users against"  

 12:  

 13:                 });

 14:  

             This link explains in details of how we can use WsFederationAuthenicationOptions. In short below are the values that we need to set it up to have the passive federation browser based login to work.

Wtrealm:  This is the identifier of your application, as assigned when you configured your app in your authenticating authority (in the Windows Azure portal for Windows Azure AD, in the management console for ADFS).
 
MetadataAddress : This value represents the Windows Azure AD tenant (or ADFS instance) you want to use for authenticating your users. If you are writing line of business apps for your own company, this line will likely never change.

If we are wondering about the CookieAuthentication that is added in the above snip of code, it’s the OWIN Cookie Authentication middleware component (we can be downloaded from Microsoft.Owin.Security.Cookie  nuget) which not only performs the operation of issuing the cookie and validating the cookie on the subsequent request but also the converts  the response and redirect to the login page upon failure. The best part of this middle ware is that it is claim-aware ..

Hope this helps someone who is trying to get the OWIN middleware for enabling browser based sign-on using WsFederation… Happy coding!

Ganesh Shankaran

Software Development Engineer

Small Basic Featured Program – Gravity Simulator

This is a Gravity Simulation by Zock77, the import code is FHS907.

It includes self interaction between orbiting satellites – they attract each other.

The gravitational force attracting objects is given by Newton.  If the object masses are M and m and their separation is r, then the force of attraction is:

F = GMm/r2

G is the gravitational constant and r2 is r squared.

The force is on a line between the two objects and acts as an acceleration on both objects towards each other.  The acceleration of each object (A and a) is proportional to the force and inversely proportional to its mass, F = M.A and F=m.a.

The sun’s mass is 50 times that of the satellites and is set to remain stationary, and it dominates the trajectories of the orbiting objects. 

A couple of suggestions to try playing with the code.

  • Get the sun to wobble with the orbiting objects.
  • Set the satellites to have a mass equal to the sun.

Nice program Zock.

Getting Started With Your First Indie Game

This post is part of our #idevthis series where we focus on bringing developers together around the desire to create. Share your latest creation with the community using the the #idevthis hashtag on Twitter.

People spend more money on game apps than any other category. In fact, in 2012 over 57% of all paid downloads were games (and that number is only growing). That creates a great opportunity for anyone that has even the most basic coding skills thanks to a bevy of tools, resources, and people that make jumping into the game dev space easier than ever.

Join Our #GameDevChat!

As a lead up to a great MVA Jumpstart Webinar on 9/25 all about developing games in Construct 2, we decided to hold a #gamedevchat on Twitter to give developers a chance to get to know the speakers, share advice, and answer questions about getting started in beginner game development overall.

When: 9/22, (9:30 AM PST)

Where: #GameDevChat

What: Advice & Insights for Beginner Game Devs

Connect With Our Featured Guests

 

James Quick (@jquickwit), Shahed Chowdhuri (@shahedC), and Diego Lizarazo are all experienced game devs and Technical Evangelists that will be at your service. Feel free to check out their latest projects on their blogs or connect with them on Twitter before and after the chat.

Ground Rules

If this will be your first Twitter chat, here’s a few guidelines that will ensure your voice doesn’t get lost in the excitement:

  1.  Include the #GameDevChat hashtag in everything you tweet (including questions and responses directly to other participants or the featured guests). Every question or insight that you want to contribute makes the conversation richer so fire away!
  2. Re-tweet the good stuff! The more you get the word out, the more people that will join. The more that join, the better the conversation.
  3. Continue the conversation with one another and all of our featured guests before, during, or after the chat.

After the Chat

You can catch the featured guests again live on 9/25 in their Construct 2 MVA Jumpstart Webinar. Register for the event and stay in touch with the speakers for ongoing support of your first (or next) great game.

While you build your app, let us know about it! Share screenshots of your app in progress or even share a short demo and tweet it out to the #idevthis hashtag. Who knows, maybe you’ll end up as our next featured guest!

Azure Notification Hubs ???????????????

 このポストは、9 月 5 日に投稿された Simplifying working with Azure Notification Hubs の翻訳です。

現在、Service Bus の名前空間の 97% 近くで、Notification Hubs または何らかのメッセージング エンティティ (Queue、Topic、Relay、Event Hub) のいずれかが使用されており、きわめて稀なケースではこの両方が共に使用されています。Notification Hubs とメッセージング エンティティを併用するという現在の方法をよりわかりやすいものにして、Service Bus のバックエンドでこれらのエンティティを管理しやすくするために、マイクロソフトでは両者のユーザー エクスペリエンスを分離できるように取り組んでいます。その第一歩として今回は、名前空間で Notification Hubs を作成するのか、それともいずれかのメッセージング エンティティを作成するのか、名前空間の目的を明示的に選択できるようにしました。近い将来、今回の変更を基にして、Service Bus 固有のコンポーネントにオーバーヘッドを発生させることなく、SDK から Notification Hubs を簡単に利用できるようにしたいと考えています。これにより、お客様から寄せられている主な問題点の 1 つに対処できることになります。

メモ: 今回の機能変更は、随時利用できるようになる予定です。今回の変更について不明な点または問題点などがありましたら、ぜひご連絡ください。

 新しい名前空間を作成する際、名前空間の種類として新しい選択肢が追加されます。名前空間で Notification Hubs を作成する場合は [NOTIFICATION HUB] を選択し、それ以外の場合は既定値 ([MESSAGING]) のままで名前空間を作成します。1 つの名前空間で Notification Hubs とメッセージング エンティティの両方を作成する場合、今後はそれぞれ個別の名前空間を作成する必要があります。ちなみに、既存の名前空間は、1 つの名前空間で Notification Hubs とメッセージング エンティティの両方を使用している場合であってもこれまでどおり利用できますが、それぞれ別の名前空間に分けて使用することを強くお勧めします。

 

名前空間が作成されると、名前空間の一覧に「TYPE」という名前の新たな列が表示されます。TYPE 列には次の 3 つの値のいずれかが示されます。

1.    Messaging – 種類 (TYPE) に既定の [MESSAGING] を指定して作成した新しい名前空間

2.    Notification Hub - 種類 (TYPE) に [Notification Hub] を指定して作成した新しい名前空間

3.    Mixed - Notification Hubs とメッセージング エンティティの両方を使用する既存の名前空間。この種類の名前空間とそこで使用しているエンティティはこれまでどおり利用できますが、Mixed タイプの名前空間を新たに作成することはできません。

当面の間は、これまでどおりのエクスペリエンスを提供するために、既存の名前空間の種類はすべて Mixed として表示されます。ただし、マイクロソフトでは名前空間の種類を正しく更新するための作業を 1 か月以内に行う予定です。したがって、Notification Hubs だけを使用する名前空間は「Notification Hub」に、また、メッセージング エンティティだけを使用する名前空間は「Messaging」に更新されます。これによって、現在のエンティティの使用方法が変わることは一切ありません。��き続きすべてこれまでどおりにご利用いただけます。

 

Service Bus エンティティの [QUICK CREATE] と [CUSTOM CREATE] の使用については、基本的にこれまでどおりですが、唯一の変更点は、作成するエンティティに応じて名前空間のドロップダウンで自動的にフィルタリングが行われるようになったことです。これにより、たとえば Notification Hubs を作成する場合は、Notification Hub タイプの名前空間 (および、当面の間は Mixed タイプの名前空間) が表示されます。

 

また、名前空間をクリックすると、種類に応じてカスタマイズされたトップ レベル メニューが表示されます。

 

 

Notification Hub タイプの名前空間には Notification Hubs を作成および構成することができ、Messaging タイプの名前空間にはメッセージング エンティティのいずれかをこれまでどおりに作成および構成することができます。現在、Notification Hubs とメッセージング エンティティの両方を使用する Mixed タイプの名前空間を利用している場合は、個別の名前空間に分けることをお勧めします。

PowerShell コマンドレットまたは REST API を直接使用して名前空間を作成する場合、現時点では Mixed モードで名前空間が作成されます。今回はこれに関する大幅な変更はありません。ただし、今後のリリースでコマンドレットの更新を行い、「Messaging」を既定値とするオプションのパラメーターとして NamespaceType を追加する予定です。したがって、このコマンドレットを使用して名前空間を作成する場合は、名前空間の種類として明示的に「Notification Hub」を指定する必要があります。

最後までお読みいただきありがとうございました!

 

ALM Rangers Triage #9 – the first of the rolling triages

If you have recently submitted an ALM Rangers solution idea on Visual Studio UserVoice, you should read on and determine if you are happy with the triage results. You can and should influence future triages!
As discussed in Triage of ideas … ∆ process changes we have switched to rolling. This is the first!

current status

We have two projects (flights) that are in their last Quality-Planning (QP) sprint, which triggered this rolling triage. While the “Config as Code” project is waiting on the completion of copy editing and quality essentials processes, the ALM Readiness Treasure Map team is troubleshooting a start-up race condition.  

image

current status

In are our project idea triages effective? Help us reflect and innovate! we asked you for feedback on your satisfaction of the project ideas we selected in recent triages and have subsequently shipped. In future we will release the satisfaction polls earlier and to the broader community, so that we can determine whether the decisions made at the triage, result in win:win solutions for you.

image

triage 9 results and recommendations

All project ideas are now plotted in the Product Group and Ranger/Community value quadrant. The latter is dependent on your votes for ideas posted on Visual Studio UserVoice.

The green area shows the win:win projects, which have are typically the ones that receive permission to start taxiing  to the project runway for take-off.

image

  1. We added new indicators to show the trend of ideas that were carried over from previous triages. Unit Test Generator rating remained unchanged.
  2. Project Unicorn is our next big “gig” … watch the space. Resources for the DSC Library v2 is the other project that received he “thumbs up” and continues from where Create quality guide about Config as Code for DevOps and ALM practitioners left off.
  3. Git for the TFVC Users guide is still on hold, but scheduled for consideration ASAP.
  4. ALM Readiness Treasure Map rating increased slightly in terms of Ranger Value, but has not yet entered the win:win quadrant.
  5. SAFe Practical Guidance, Cloud Service Model Guide and Provisioning VMs to Azure with DSC decreased slightly in terms of Ranger Value. All remain outside the win:win quadrant.

how do you influence the rangers “value” in future triages?

Project Idea

You can influence by…

SAFe Practical Guidance

Find idea on UserVoice Rangers. Add votes to increase or remove votes to decrease computed Ranger value. Ask your community for their votes.

ALM Treasure Map v4

Find idea on UserVoice Rangers. Add votes to increase or remove votes to decrease computed Ranger value. Ask your community for their votes.

Cloud Service Model Guide

Add a comment below and share your views.

Provisioning VMs to Azure with DSC

Find idea on UserVoice Rangers. Add votes to increase or remove votes to decrease computed Ranger value. Ask your community for their votes.

Unit Test Generator OSS

Add a comment below and share your views.

Support p&p DevOps Patterns Guide

Add a comment below and share your views.

TFS on Azure IaaS Guide Update v2

Find idea on UserVoice Rangers. Add votes to increase or remove votes to decrease computed Ranger value. Ask your community for their votes.

Convert Testing Quick Guide into Wiki

Find idea on UserVoice Rangers. Add votes to increase or remove votes to decrease computed Ranger value. Ask your community for their votes.

Git for TFVC User Guide v3.1

Add a comment below and share your views.

Custom UI controls for custom app

Find idea on UserVoice Rangers. Add votes to increase or remove votes to decrease computed Ranger value. Ask your community for their votes.

how do add new ideas for future triages?

Ensure that you deliver the following minimum information when submitting a project idea, to avoid delays:

  • Crisp title
  • Crisp description
  • Definition of what the problem and why it needs a solution
  • 1-3 crisp objectives

deleted project ideas

image_thumb[4]

We deleted no project ideas from the ideas backlog this time. All queued ideas will be re-triaged.

questions

Have we missed anything? Thoughts?

Remember to capture YOUR project ideas on UserVoice so that they light up in the next triage.

reference posts

ASP Code and No Managed Code Option in Application Pool

 

The No Managed Code setting for the application is clear in the TechNet page http://technet.microsoft.com/library/hh831797.aspx as stating to use this setting for applications that will NOT use the .NET framework.

clip_image001

By selecting the version of the .NET framework for the application, the worker process will load the version of the CLR for the application to run correctly.

The No Managed Code setting for the application pool is meant to run scripting engines like ASP as the CLR will NOT be loaded in the worker process and may improve performance of the start up for the worker process.

Just make sure the ASP code is not making a code reference to a .NET resource.