Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Mastering Cloud Development using Microsoft Azure
Mastering Cloud Development using Microsoft Azure
Mastering Cloud Development using Microsoft Azure
Ebook650 pages3 hours

Mastering Cloud Development using Microsoft Azure

Rating: 0 out of 5 stars

()

Read preview

About this ebook

About This Book
  • Build an effective development environment in Azure using the right set of technologies.
  • Architect a full-stack solution in the cloud to choose the best service set
  • A comprehensive guide full of real-life examples to help you take your developer skills up a notch
Who This Book Is For

If you are a developer, a full stack developer, or an architect with intermediate-level understanding of cloud computing and Microsoft Azure and you want to take your skills up a notch, this book is for you. Prior knowledge and understanding of cloud development strategies is assumed.

LanguageEnglish
Release dateJun 28, 2016
ISBN9781782173342
Mastering Cloud Development using Microsoft Azure

Read more from Roberto Freato

Related to Mastering Cloud Development using Microsoft Azure

Related ebooks

Computers For You

View More

Related articles

Reviews for Mastering Cloud Development using Microsoft Azure

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Mastering Cloud Development using Microsoft Azure - Roberto Freato

    Table of Contents

    Mastering Cloud Development using Microsoft Azure

    Credits

    About the Authors

    About the Reviewer

    www.PacktPub.com

    eBooks, discount offers, and more

    Why subscribe?

    Instant updates on new Packt books

    Preface

    Facing new challenges

    What this book covers

    What you need for this book

    Who this book is for

    Conventions

    Reader feedback

    Customer support

    Downloading the example code

    Downloading the color images of this book

    Errata

    Piracy

    Questions

    1. Building Basic Services

    CloudMakers.XYZ

    Scenario 1 – Bootstrapping the company

    Setting up the development environment

    Where is my data center?

    Building a development machine

    Generalizing the VM

    Implementing the development process

    Creating a new VSO environment

    Integrating Visual Studio

    Integrating third-party services

    Provisioning development environments for mobility

    Azure Active Directory

    Azure RemoteApp

    Automating repetitive operations

    Azure Automation

    Azure Scheduler

    Summary

    2. Enhancing the Hybrid Process

    CloudMakers.XYZ

    Service Manager (classic) mode versus Resource Manager mode

    Configuring a Resource mode Virtual Network for the frontend servers

    Configuring a Service mode (classic) Virtual Network for the backend servers

    Connecting two virtual networks with site-to-site connection

    Configuring Office connectivity with a point-to-site VPN

    Deploy a Windows Azure Virtual Machine in an ARM Virtual Network

    Managing virtual networks with Operational Insight

    System Update Assessment

    SQL Assessment

    Malware Assessment

    Summary

    3. Building the Frontend

    It's all about data

    Polyglot Persistence

    Scenario

    Writing catalogs into Azure DocumentDB

    Building up your web frontend with Microsoft ASP.NET MVC

    Searching in catalogs via Azure Search

    Storing unstructured data in Azure Storage

    Speeding up data access with caching and Azure Redis

    Persisting a shopping cart with Azure Table Storage

    Publishing your application into Azure web apps

    Configuring a web application with a Custom Domain Name

    Summary

    4. Building the Backend

    CloudMakers.XYZ scenario evolution

    Handling orders

    Decoupling user actions from SQL sinking

    Producing denormalized data for analysis

    Extracting, transforming, and loading data into a data warehouse

    Predicting valuable information with machine learning

    Outsourcing Identity and Access Management

    Azure AD and claims-based authentication

    Azure Active Directory B2C

    Advanced features

    Summary

    5. Building the Mobile Experience

    The technical community case study

    Writing mobile applications

    Building a mobile app with Visual Studio Tools for Apache Cordova

    The need for a fast and easy solution

    Introduction to mobile apps

    Getting data from the service

    Sending data to the service

    Azure and Node.js

    Summary

    6. Building the API Layer

    CloudMakers.XYZ scenario evolution

    Building the API

    Using the ASP.NET Web API

    ServiceStack

    Documenting the API with the Swagger/OpenAPI

    Deploying the API

    Advanced App Service features

    App Settings management

    Slots and traffic routing

    Continuous deployment

    Hybrid connections

    Application logs

    Backup and restore

    API Gateway

    Using Azure API Management

    Creating an API

    Using policies

    Identity and Access Management

    Advanced APIM Management

    Debugging complex API workflows

    Debugging App Service with remote debugging

    Using a Service Bus relay to debug REST services

    Summary

    7. Working with Messages

    Dealing the future with commands

    Messages and queues

    The scenario

    Sending messages with queues

    Processing messages with workers

    Dealing the past with events

    Per-message event handling

    Per-stream event handling

    Collecting events with Azure Event Hubs

    Processing event streams with Azure Stream Analytics

    Summary

    8. Deploying Solutions in Azure

    Azure Resource Manager

    Writing the template

    Programming the template

    Organizing deployment tasks with the Deploy to Azure button

    Summary

    Index

    Mastering Cloud Development using Microsoft Azure


    Mastering Cloud Development using Microsoft Azure

    Copyright © 2016 Packt Publishing

    All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

    Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

    Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

    First published: June 2016

    Production reference: 1220616

    Published by Packt Publishing Ltd.

    Livery Place

    35 Livery Street

    Birmingham B3 2PB, UK.

    ISBN 978-1-78217-333-5

    www.packtpub.com

    Credits

    Authors

    Roberto Freato

    Marco Parenzan

    Reviewer

    Florian Klaffenbach

    Commissioning Editor

    Amarabha Banerjee

    Acquisition Editor

    Tushar Gupta

    Content Development Editor

    Viranchi Shetty

    Technical Editor

    Ravikiran Pise

    Copy Editors

    Safis Editing

    Karuna Narayanan

    Stuti Srivastava

    Project Coordinator

    Izzat Contractor

    Proofreader

    Safis Editing

    Indexer

    Mariammal Chettiyar

    Graphics

    Jason Monteiro

    Production Coordinator

    Aparna Bhagat

    Cover Work

    Aparna Bhagat

    About the Authors

    Roberto Freato has been an independent IT consultant since he started to work. Working for small software factories while he was studying, after his M.Sc. in Computer Science Engineering with his thesis on Consumer Cloud Computing, he got specialization in Cloud and Azure. Today, he works as a freelance consultant for major companies in Italy, helping clients design and kick off their distributed software solutions. He trains the developer community in his free time, speaking at many conferences. He has been a Microsoft MVP since 2010.

    I would like to thank Simona, Mom, and Dad.

    Marco Parenzan is an experienced .NET developer, now also a Cloud Computing and Azure trainer. A Microsoft MVP on Azure since 2014, he is curious about the IoT business and architectures. He loves retrogaming, and he tries programming little games in his spare time. He is a community lead for 1nn0va, a local Microsoft community in Pordenone, Italy, and he likes training developers in companies and university.

    First, I'm grateful to Roberto for involving me writing this great book. One of my dreams was sharing my knowledge of technology, which started many years ago when my friend Marco Pozzan involved me in 1nn0va, our local Microsoft community in Pordenone. This book helped me achieve this dream.

    Finally, I want to thank my wife, Paola, and our two beloved children for supporting me and giving me the large amount of time I needed to complete this book.

    About the Reviewer

    Florian Klaffenbach started his IT carrier in 2004 as the first and second level IT support technician and IT salesman trainee for a B2B online shop. After this, he moved to a small company, working as IT project manager, involved in planning, implementing, and integrating industrial plants and laundries into enterprise IT. After spending some years there, he joined Dell Germany. Here, he started from scratch as an Enterprise technical support analyst and later worked on a project to start Dell Technical Communities and support over social media in Europe and outside the U.S. Currently, he works as a solutions architect and consultant for Microsoft Infrastructure and Cloud specialized on Microsoft Hyper-V, fileservices, System Center Virtual Machine Manager, and Microsoft Azure IaaS.

    Additionally to his job engagement, he is active as a Microsoft blogger and lecturer. He blogs at his own page, Datacenter-Flo.de, or Azure Germany Community. Together with a very good friend, he founded the Windows Server User Group Berlin to create a network of Microsoft ITPros in Berlin. Florian maintains a very tight network for many vendors such as Cisco, Dell, Microsoft, and communities. This helps him increase his experience and get the best solution for his customers. Since 2016, he is also co-chairman of the Azure Community Germany. In April 2016, Microsoft awarded Florian as Microsoft's Most Valuable Professional for Cloud and Datacenter Management.

    Florian worked for several companies, such as Dell Germany, CGI Germany, and his first employer TACK GmbH. Currently, he works at msg service ag as Senior Consultant Microsoft Cloud Infrastructure.

    He has worked on the books Taking Control with System Center App Controller, Microsoft Azure Storage Essentials, Mastering Microsoft Azure Development, and Mastering Microsoft Deployment Toolkit 2013 for Packt Publishing before working on this book.

    I want to thank Packt Publishing for giving me the chance to review the book. I would also like to thank my employer. I especially want to thank my girlfriend for not killing me because I spend so much of my spare time on the community and work.

    www.PacktPub.com

    eBooks, discount offers, and more

    Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at for more details.

    At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

    https://www2.packtpub.com/books/subscription/packtlib

    Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

    Why subscribe?

    Fully searchable across every book published by Packt

    Copy and paste, print, and bookmark content

    On demand and accessible via a web browser

    Instant updates on new Packt books

    Get notified! Find out when new books are published by following @PacktEnterprise on Twitter or the Packt Enterprise Facebook page.

    Preface

    This is a book for you, the developer, who lives in his/her comfort zone. This book is made up of the experience gained during the evolution of the Web from its inception (the nineties) to the present. Earlier, you used a single reference architecture and reused it as many times as possible. This is because you grew up in an object-oriented development era with a focus on tools and languages. Therefore, you are used to developing web and applications in the same manner using the same tools. You find moving away from a monolithic, three tier, strongly-coupled, SQL-based, on-premise, web-only development environment uncomfortable.

    This is a book for you, the developer, who does not know why you should move away from your comfort zone, or you do not find real value evolving your skills and embrace the cloud.

    You are not alone; many other developers over the world feel the same way we did just quite some time ago.

    Facing new challenges

    Software complexity is increasing over time and we need to concentrate on the functional aspects of domain problem, coding domain logic, and presentation. If possible, we would reuse as many functionalities that we could if they respected common patterns that were accepted, solved, and shared by developer community.

    Development is different to Operations, as the developer has a different role from an IT professional. While developing solutions, we cannot really avoid any knowledge about operations, deployment, security, and authentication issues.

    On-premise, many solutions are avoided because of lack of business view and no clearance from the management. We need to move our business costs from capital expenses to operation expenses. This lowers acquisition barriers as every company, single professionals, or small independent teams can access the same cloud power. We can also view this as a democratization of the web.

    We now live in a global village, and we need to deploy our solutions worldwide, minimizing latency and give the users better responses without moving away from our company and country.

    We need a self-service approach to turn services on and off, instantiating and destroying appliances, which allow us to control costs and invites experimenting, new technologies, platforms, and architectures.

    The cloud democratizes access to advanced deployment scenarios such as clustering and high availability, backup, and operational management.

    This is a book for you, the developer, who feels uncomfortable and needs to improve your skills and embrace the cloud. This book is all about real-world scenarios where you can train new skills and the start mapping your daily projects in this new and exciting world.

    Let's move on, together.

    What this book covers

    Chapter 1, Building Basic Services, shows you how to start approaching the basic concepts of cloud computing in Azure and how to move some basic on-premise functionalities to the cloud.

    Chapter 2, Enhancing the Hybrid Process, shows you how to integrate services to your local environment and processes and how to move virtual machine and networking concepts to the cloud.

    Chapter 3, Building the Frontend, shows you how to build a comprehensive frontend composed of Azure services and approach the Platform-as-a-Service model to reduce costs.

    Chapter 4, Building the Backend, explains how to use polyglot persistence to build a tailored-data platform, where each logical application block has its corresponding optimal technology and evaluate some new technologies to embrace new challenges.

    Chapter 5, Building the Mobile Experience, covers the world of mobile apps development from the hybrid apps point of view and how a mobile-focused developer can approach building a backend Azure service.

    Chapter 6, Building the API Layer, shows you how to handle real world API development, deployment, and long-term management.

    Chapter 7, Working with Messages, shows you how you can build solutions composed by different blocks and explains the services that need to communicate in an asynchronous a decoupled manner.

    Chapter 8, Deploying Solutions in Azure, shows you how to handle Azure service and to proceed with deployment in a formal, repeatable, and modern way.

    What you need for this book

    You need a good spec machine with any version of Windows from Window 7 to Windows 10 installed on it.

    Visual Studio 2015 is the development environment that you require for this book, and all features required for this book are available from the free Community edition (https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx).

    Azure SDK for Visual Studio 2015 is required, and you can download it at https://azure.microsoft.com/en-us/downloads/.

    You will sign up for a Microsoft Azure subscription at the start of the book if you have not already got one: there are various paid options, but a one-month trial is available.

    There is also the Visual Studio Dev Essentials initiative (https://www.visualstudio.com/en-us/products/visual-studio-dev-essentials-vs.aspx), which gives us access to many benefits, such as an Azure subscription with $25 prepaid monthly credit.

    Who this book is for

    This book is for developers who want to improve their development skills in terms of development style and patterns with the cloud using some real-world, end-to-end scenarios, inspiring them to map their real projects at home.

    This book is for Windows and .NET developers, as examples are mainly displayed as ASP.NET and C# code.

    Conventions

    In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

    Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: First, deallocate the VM by invoking the deallocate command.

    A block of code is set as follows:

      10.1.0.0/16

      DataServer>

      10.1.2.0/24

    Any command-line input or output is written as follows:

    $vn = Get-AzureRmVirtualNetwork

      -ResourceGroupName CloudMakers -Name CloudMakers

    New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: Locate the New action and choose Data + Storage (or another semantically equivalent group).

    Note

    Warnings or important notes appear in a box like this.

    Tip

    Tips and tricks appear like this.

    Reader feedback

    Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

    To send us general feedback, simply e-mail <feedback@packtpub.com>, and mention the book's title in the subject of your message.

    If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

    Customer support

    Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

    Downloading the example code

    You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

    You can download the code files by following these steps:

    Log in or register to our website using your e-mail address and password.

    Hover the mouse pointer on the SUPPORT tab at the top.

    Click on Code Downloads & Errata.

    Enter the name of the book in the Search box.

    Select the book for which you're looking to download the code files.

    Choose from the drop-down menu where you purchased this book from.

    Click on Code Download.

    You can also download the code files by clicking on the Code Files button on the book's webpage at the Packt Publishing website. This page can be accessed by entering the book's name in the Search box. Please note that you need to be logged in to your Packt account.

    Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

    WinRAR / 7-Zip for Windows

    Zipeg / iZip / UnRarX for Mac

    7-Zip / PeaZip for Linux

    The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Mastering-Cloud-Development-using-Microsoft-Azure. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

    Downloading the color images of this book

    We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/MasteringCloudDevelopmentusingMicrosoftAzure_ColorImages.pdf.

    Errata

    Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

    To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

    Piracy

    Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

    Please contact us at <copyright@packtpub.com> with a link to the suspected pirated material.

    We appreciate your help in protecting our authors and our ability to bring you valuable content.

    Questions

    If you have a problem with any aspect of this book, you can contact us at <questions@packtpub.com>, and we will do our best to address the problem.

    Chapter 1. Building Basic Services

    Platform-as-a-Service (PaaS) is probably the next (or current) big thing in computing that is here to stay in the future of software and services. With PaaS, companies can abstract their services from the underlying IT infrastructure, investing the majority of the effort in the core business instead of managing several building blocks, often with repetitive actions and operations.

    However, Azure is not just PaaS, and in this chapter, we are going to use IaaS instead. Infrastructure-as-a-Service (IaaS) is a model-provisioning IT low-level infrastructure (such as virtual machines) that works without having to manage the entire stack as it takes place on-premise.

    A figure showing what customers manage (blue) in different scenarios.

    In this chapter, we present the first scenario of the book, where a fictional company wants to start up, minimizing the initial IT investment as well as the time to market. We learn how several Azure building blocks (such as virtual machines, Visual Studio Online, Azure Resource Manager, RemoteApp, Azure Storage, among others) can be combined in order to provide a set of foundation platforms for a software development company.

    CloudMakers.XYZ

    As mentioned in the preface, in order to better understand the key points of this book, we decided to translate them into practical situations, using scenarios taken from a fictional company named Cloud Makers XYZ (hereafter mentioned as just CloudMakers or CM).

    The entire book is divided into four main scenarios, which explore the company's assets in a step-by-step manner, focusing on how Microsoft Azure has been used to provide foundation services:

    Scenario 1: Bootstrapping the company

    Scenario 2: Building the e-commerce product

    Scenario 3: Building the GeoProvider product

    Scenario 4: Enhancing the company

    These four scenarios have been conceived to create a coherent and straightforward path for readers who are already aware of the issues to be managed when dealing with software and services. Furthermore, it is useful in order to understand cloud services, such as Microsoft Azure, while they are used in connection with existing processes and workflows instead of having them deployed as is with Hello World samples.

    Real-world experiences are the inspiration behind providing the samples shown in the scenarios; the majority of the tips, procedures, and code samples come from real production environments.

    Note

    As with many books claiming to represent a best practice or a suggested usage of a given service, this book does not have a complete understanding of what's going on in your specific company. We also know that each case is different and, finally, we strongly believe that architectures are not good or bad in an absolute sense and that they depend on specific use cases.

    Hence, in this chapter and in the next one, we walk through the first scenario, where CM is bootstrapping itself.

    Scenario 1 – Bootstrapping the company

    CloudMakers is a newly founded company in Milano, Italy. The founders are as follows:

    Han, the CEO (chief executive officer), has a strong management background. His top qualities are leadership and commitment. He deeply understands technical inputs from the CTO and translates them into opportunities for the market. However, he demonstrated almost no real knowledge of how to build software.

    Luke, the CTO (chief technology officer), has a strong technical background. He prototypes new products, helps select candidate developers, and is responsible for the quality of the software produced by CM in general.

    Leila, the CFO (chief financial officer) and main project manager, is responsible for the financial strategy of CM and is in charge of managing and monitoring the projects delivered by CM.

    In addition to these three key people, who have been getting along for many years before founding CM, there are a couple of additional, IT-related people:

    Owen, a senior IT professional, has a strong background in managing IT infrastructure. Before joining CM, he was responsible for the entire physical infrastructure of his old workplace.

    Flint, a full-stack developer, has previous experience in a failed start-up. He has been hired to develop the main products with Luke and learn everything about cloud computing and Microsoft Azure from him.

    A summary of the most relevant resources of CloudMakers

    CM has been founded with a very limited budget, and the board has taken the decision to minimize the IT investment in order to prioritize their marketing and advertisement efforts until they break even. Under this constraint, every initial investment should be evaluated and approved while pay-per-use services are welcomed.

    Luke planned to build the new core infrastructure on Microsoft Azure, using the cloud to quickly deliver new services as well as the development environments required for the entire company and the technical team.

    He planned to implement a BYOD (Bring Your Own Device) policy to reduce the governance of physical assets; so, the employees are invited to use their personal laptops and mobile phones for the purpose of work while they're at home or in the office.

    Luke's plan is to build a consistent development environment entirely on the cloud, where employees can connect through Remote Desktop Protocol (RDP) to do their work (refer to the Setting up the development environment section).

    Since the majority of the code is going to be written using Visual Studio and Luke has had strong experience in using Team Foundation Server (TFS) for Application Lifecycle Management (ALM), CM is going to use Visual Studio Online to store the company's code base as well as to help Leila keep track of the actual activities of the technical team (refer to the Implementing the development process section).

    Since Luke is often out of the office due to several business events with Han and due to his participation in international meetings about start-ups and technical conferences and as a consequence of the ability of the entire staff to work from home, CM planned to introduce a way to let employees have a complete workplace even from their mobile devices: smartphones, tablets, and non-Windows PCs (refer to the Provisioning development environments for mobility section).

    After a demand made by Owen, overwhelmed by growing requests from Flint to prepare a complex Test/Prod Deployment Environment, Han

    Enjoying the preview?
    Page 1 of 1