Visual Studio WebJobs Walkthrough

image

  1. Create an ASP.NET WebApp
  2. At project node, Add “New Azure WebJob Project”
  3. Choose project type: Continuous/OnDemand/Schedule
    1. Continuous:
      1. A JobHost.RunAndBlock(); in void Main().
      2. A method for [QueueTrigger/BlobTrigger(queuename)] to dequeue message from queue
    2. On Demand/Schedule:
      1. A JobHost.Call(methodname, value) in void Main().
      2. A method for [Queue/Blog(queuename)] to enqueue  message to the queue 
  4. Publish WebApp and/or WebJob projects to Azure. And you will find the WebJob deployed under the WebApp App_Data folder
  5. Configuration: Add Azure Storage Connection String to Live Azure Web Site.
    1. Go to Server Explorer –> Storage to get Storage Connection String
      • image
      • image
    2. Go to  Websites –> Settings, create 2 entries AzureWebJobsStorage & AzureWebJobsDashboard. And select Custom from the Database Type column.
      • image
  6. Debug Contiuous WebJob: In Server Explorer, goto your WebJob and make sure it is started.
    1. Attach Debugger. Set your breakpoints.
      1. image
    2. View static Logs.
  7. Run OnDemand WebJob to send message to the queue which will in turn trigger any breakpoints in the continuous WebJob.
    1. image

Ref:

https://github.com/Azure/azure-webjobs-sdk-samples

http://blogs.msdn.com/b/webdev/archive/2014/11/12/new-developer-and-debugging-features-for-azure-webjobs-in-visual-studio.aspx

Manage Azure using Windows PowerShell with publishsettings file

 

Use the certificate method

The Azure module includes cmdlets that help you download and import the certificate.

  • The Get-AzurePublishSettingsFile cmdlet opens a web page on the Azure Management Portal, from which you can download the subscription information. The information is contained in a .publishsettings file.

  • The Import-AzurePublishSettingsFile imports the .publishsettings file for use by the module. This file includes a management certificate that has security credentials.

e.g.

Import-AzurePublishSettingsFile “c:\mydownloaded.publishsettings”

Get-AzureAccount

Get-AzureSubscription

Stop-AzureVM -ServiceName “myServiceName” -Name “myName” -StayProvisioned

Azure Active Directory for MVC & WebAPI

image

Azure Friday

Update:

Connect() – This video provides a quick overview of Azure Active Directory from a developer’s standpoint and gives a glimpse of the new identity features in Visual Studio 2015 that make it easy to secure applications with Azure AD.

Azure Active Directory SSO using Visual Studio 2015

 

Here is the instruction on using Visual Studio 2015 preview to add Azure Active Directory SSO to an existing MVC Application.

1. Create an Azure Active Directory

2. Add user(s) to directory

3. Right-click the project and click “Configure Azure AD Authentication”

image

4. Enter your Active Directory Domain Name e.g. yourid.onmicrosoft.com  This will integrate an Application to the Active Directory

image

5. Click the Application Link and click the Configure Tab and change the “Reply Url” to your webiste’s Url so Azure AD know where to send the SAML authentication tokens after successfully authenticated the Users.

e.g. https://mywebapp.azurewebsites.net/

6. optional update the [Authorize] attribute in the controllers

7. optional add the login/logout/username html to the view. e.g. add @Html.Partial(“_LoginPartial”) to _layout.cshtml

8. Finally publish the WebApp to Azure. Right click on project and click “Publish…”

Katana–OWIN implementation from Microsoft

Katana Architecture

The Katana component architecture divides an application into four logical layers, as depicted below: host, server, middleware, and application. The component architecture is factored in such a way that implementations of these layers can be easily substituted, in many cases, without requiring recompilation of the application.

image

An example of components from different layers
  • Host: IIS/ASP.NET, OwinHost.exe, Self-Host/Custom-Host(e.g. Windows Service)
  • Server: SystemWeb(ASP.NET pipeline), HttpListener (OwinHost/Self-Host/Custom-Host)
  • Middleware: Web API, SignalR, Nancy
  • Application: Your Application.

http://www.asp.net/aspnet/overview/owin-and-katana

Documentation: http://katanaproject.codeplex.com/documentation

 

owin

Azure Scheduler–run jobs on simple or complex recurring schedules

image

Scheduler

Run your jobs on simple or complex recurring schedules
  • Call services inside or outside of Azure
  • Run jobs on any schedule—now, later, or recurring
  • Use Azure Storage queues for long-running or offline jobs
  • Management REST API

Get Started using Scheduler MSDN

Videos:

Using Visual Studio to build Cross Platform JavaScript Native Apps using Cordova

 

image

Demo (Build Android, iOS app. Deploy to Ripple, Xcode iPhone Simulator on Mac, Android Device): http://channel9.msdn.com/Shows/Visual-Studio-Toolbox/Multi-Device-Hybrid-Apps

MSDN: http://msdn.microsoft.com/en-us/vstudio/dn722381

Documentation: http://msdn.microsoft.com/en-us/library/dn771545.aspx

Stackoverflow: http://stackoverflow.com/questions/tagged/multi-device-hybrid-apps

Samples:

Cordova: http://cordova.apache.org/