Final microsoft cloud summit - windows azure building block services


Published on

This is my presentation from the Dallas Cloud Summit on July 10th, 2012. It covers ACS and WIF, Cache, and Service Bus topics.

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Take some time here.
  • By definition, the use of high availability multiplies the amount of required memory for each cached item by the number of copies. Consider this memory impact during capacity planning tasks.
  • Windows Azure offers cache notifications that allow your applications to receive asynchronous notifications when a variety of cache operations occur on the cache cluster. Cache notifications also provide automatic invalidation of locally cached objects.To receive asynchronous cache notifications, add a cache notification callback to your application. When you add the callback, you define the types of cache operations that trigger a cache notification and which method in your application should be called when the specified operations occur. A named cache needs to opt-in and enable cache notifications.
  • Dedicated Demo: /Cache/Dedicated/TwitterDemoCoLocated Demo: /Cache/CoLocated/CoLocatedCacheDemoNuget: Windows Azure Cache Preview (make sure that nuget packages includes “include prerelease”)Nuget Search (ID): Microsoft.WindowsAzure.Caching
  • MVC TempData -
  • Use dedicated cache as ASP.Net session state provider (in CacheWorkerRole2).Demo: /Cache/Dedicated/SessionStateInCacheDemoShow the sections of web.config that wire up the SessionState provider, and hook it to the CacheClient.
  • Use Service Bus Relay to expose a on-premises WCF service to cloudDemo: /ServiceBus/Relay Projects/NetTcpRelayBinding/RelayDemoServer and /RelayDemoClient projects).
  • Demo: (/ServiceBus/Queue Projects/PreWin8/MultipleWorkersDemo/QueueItemCreator and /QueueItemConsumer)Demo: Wasn’t going to show this one, but you can play with it - (/ServiceBus/Queue Projects/PreWin8/QueuesOldSchool)Demo: (If you want to play with Win8, this is the equivalent in Win8/Metro) – (/ServiceBus/Queue Projects/Win8/Queues)
  • Demo: /ServiceBus/Topic Projects/PreWin8/TopicPublisher and /TopicSubscriber
  • Slide Objectives:Security is a common request of applications. However implementing **proper** security is hard. Also, additional security-related code increases complexity and attacking service to your applications. We need authentication and authorization abstracted away so we can focus on business logics.
  • Slide Objectives:Wouldn’t it be nice if “someone” can hide all complexities and just provides simple assertions to us? On Windows Azure, this “someone” is ACS + WIF.
  • Slide Objectives:Wouldn’t it be nice if “someone” can hide all complexities and just provides simple assertions to us? On Windows Azure, this “someone” is ACS + WIF.
  • The Orange Desk is a Gate Agent (Gate 35A, for example).The Green Desk is the Ticketing Counter, who the Gate Agent will send you back to if you don’t have a valid boarding pass.The Pink Desk is the US Passport Agency, and the Blue Desk is the Drivers’ License Bureau.
  • Use ACS to manage accesses using Live ID and Google ID – after this demo, add Yahoo to visualize the interface.
  • Final microsoft cloud summit - windows azure building block services

    1. 1. @stratospher_es
    2. 2. Memcached
    3. 3. Microsoft.ApplicationServer.Caching.DataCache cache = newMicrosoft.ApplicationServer.Caching.DataCache ("default");ObjectType myCachedObject = (ObjectType)cache.Get("cacheKey");cache.Add("cacheKey", myObjectRequiringCaching);
    4. 4. <caching> <outputCache defaultProvider="DistributedCache"> <providers> <add name="DistributedCache"type="Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider, Microsoft.Web.DistributedCache" cacheName="default" dataCacheClientName="default" /> </providers> </outputCache></caching><%@ OutputCache Duration="60" VaryByParam="*" %>
    5. 5. Memcached Shim Memcached Shim Memcached Client Memcached ServerNuget: Microsoft.WindowsAzure.Caching.MemcacheShim
    6. 6. // the endpoint that is projected back through the service bus (note: NetTcpRelayBinding)// This DNS name will be "sb://[serviceNamespace]"host.AddServiceEndpoint( typeof(IProblemSolver), new NetTcpRelayBinding(), ServiceBusEnvironment.CreateServiceUri("sb", ‚metrobus", "solver")).Behaviors.Add(new TransportClientEndpointBehavior{TokenProvider =TokenProvider.CreateSharedSecretTokenProvider("owner", Microsoft.WindowsAzure.CloudConfiguratManager.GetSetting("ServiceBusSecret"))});
    7. 7. .Behaviors.Add( new TransportClientEndpointBehavior { TokenProvider =TokenProvider.CreateSharedSecretTokenProvider("owner",Microsoft.WindowsAzure.CloudConfigurationManager.GetSetting("ServiceBusSecret")) });
    8. 8. .Behaviors.Add( new TransportClientEndpointBehavior { TokenProvider = TokenProvider.CreateSharedSecretTokenProvider( "owner", Microsoft.WindowsAzure.CloudConfigurationManager .GetSetting("ServiceBusSecret")) });
    9. 9.
    10. 10.
    11. 11.
    12. 12. Comparison Criteria Windows Azure Queues Service Bus Queues Yes - First-In-First-Out (FIFO)Ordering guarantee No (through the use of messaging sessions) At-Least-OnceDelivery guarantee At-Least-Once At-Most-Once YesTransaction support No (through the use of local transactions) 30 seconds (default) 60 seconds (default)Lease/Lock duration 7 days (maximum) 5 minutes (maximum) YesBatched send No (through the use of transactions or client-side batching)
    13. 13. namespaceManager = Microsoft.ServiceBus.NamespaceManager .CreateFromConnectionString(‚…‛);if (!namespaceManager.QueueExists(queueName)) namespaceManager.CreateQueue(queueName);
    14. 14. Endpoint= sb://<namespace>; SharedSecretIssuer=<issuer>; SharedSecretValue=<sharedSecret>
    15. 15. if (messagingFactory == null) messagingFactory = MessagingFactory.CreateFromConnectionString(‚…‛);if (messageSender == null) messageSender = messagingFactory.CreateMessageSender(queueName);
    16. 16. BrokeredMessage message = new BrokeredMessage();message.Label = ‚Hello from your new message.‛message.Properties.Add( new KeyValuePair<string,object>(‚FirstName", ‚Adam"));message.Properties.Add( new KeyValuePair<string,object>(‚LastName", ‚Hoffman"));messageSender.Send(message);
    17. 17. if (messagingFactory == null) messagingFactory = MessagingFactory.CreateFromConnectionString(‚…‛);if (messageReceiver == null) messageReceiver =messagingFactory.CreateMessageReceiver(queueName);
    18. 18. BrokeredMessage message = new BrokeredMessage();// wait only 5 seconds...message = messageReceiver.Receive(new TimeSpan(0, 0, 5));if (message != null){ try{ … // Remove message from queue message.Complete(); } catch (Exception){ // Indicate a problem, unlock message in queue message.Abandon(); }}
    19. 19. namespaceManager =Microsoft.ServiceBus.NamespaceManager .CreateFromConnectionString(‚…‛);if (!namespaceManager.TopicExists(topicName)) namespaceManager.CreateTopic(topicName);
    20. 20. TopicClient topicClient =TopicClient.CreateFromConnectionString(‚…‛, topic);BrokeredMessage message = new BrokeredMessage();message.Label = ‚Hello from your new message.‛message.Properties.Add( new KeyValuePair<string,object>(‚FirstName", ‚Adam"));message.Properties.Add( new KeyValuePair<string,object>(‚LastName", ‚Hoffman"));topicClient.Send(message);
    21. 21. if (!NamespaceManager .SubscriptionExists(topicName, "AllMessages")) { NamespaceManager.CreateSubscription( topicName, "AllMessages"); ListenForMessages(topicName); }
    22. 22. MessagingFactory mf = MessagingFactory.CreateFromConnectionString(‚…‛);MessageReceiver mr = mf.CreateMessageReceiver( topicName + "/subscriptions/" + "AllMessages");BrokeredMessage message = mr.Receive();…// Remove message from subscriptionmessage.Complete();Or…// Indicate a problem, unlock message in subscriptionmessage.Abandon();
    23. 23. SqlFilter highMessagesFilter = new SqlFilter("MessageNumber > 3");NamespaceManager.CreateSubscription("TestTopic", "HighMessages",highMessagesFilter);SqlFilter highMessagesFilter = new SqlFilter(‚FirstName = ‘Adam’");NamespaceManager.CreateSubscription("TestTopic", ‚GuysNamedAdam",adamMessageFilter);MessageReceiver mr = mf.CreateMessageReceiver( topicName + "/subscriptions/" + ‚GuysNamedAdam");
    24. 24. Customer support Data Management protection UI Forget password? User store User mapping More LDAP User mapping Authentication Authorization Integration Synchronization Facebook with AD Auth API More IntegrationSynchronization With Facebook
    25. 25. IdPWIF ACS IdP
    26. 26. public class RoleSetter : ClaimsAuthenticationManager{ public override ClaimsPrincipal Authenticate(string resourceName, ClaimsPrincipal incomingPrincipal) { if (incomingPrincipal != null && incomingPrincipal.Identity.IsAuthenticated == true) { //DECIDE ON SOME CRITERIA IF CURRENT USER DESERVES THE ROLE ClaimsIdentity identity = (ClaimsIdentity)incomingPrincipal.Identity; IEnumerable<Claim> claims = identity.Claims; if (DoYourCheckHere()) ((ClaimsIdentity)incomingPrincipal.Identity).AddClaim( new Claim(ClaimTypes.Role, "Admin")); } return incomingPrincipal; }
    27. 27. <system.identityModel> <identityConfiguration> <claimsAuthenticationManager type="ClaimsTransformer.RoleSetter, ClaimsTransformer"/>…
    28. 28. if (User.IsInRole("Admin")) Response.Write("The code is 42...<br/>");else Response.Write(‚No soup for you.");
    29. 29.