Azure Developer Guide Ebook
Azure Developer Guide Ebook
The Developer’s
Guide to Azure
Published May 2019
May The Developer’s 2
2019 Guide to Azure
03 / 40 / 82 /
Introduction Chapter 3: Securing Chapter 6: Where
your application and how to deploy
We’re here to help
your Azure services
How can Azure help secure
05 / your app?
Encryption
How can Azure deploy your
services?
Chapter 1: Getting Azure Security Center Infrastructure as Code
started with Azure Logging and monitoring Azure Blueprints
Containers in Azure
51 /
What can Azure do for you? Azure Stack
Where to host your Where to deploy,
application and when?
Chapter 4: Adding
Azure App Service Features
intelligence to
Azure Functions
Azure Logic Apps your application 89 /
Azure Batch
Containers How can Azure integrate AI
Chapter 7: Share your
What to use, and when? into your app? code, track work, and ship
Making your application Azure Search software
more performant Cognitive Services
Azure Front Door Azure Bot Service How can Azure help you plan
Azure Content Delivery Azure Machine Learning smarter, collaborate better, and ship
Network Studio your apps faster?
Azure Redis Cache Developer tooling for AI Azure Boards
AI and mixed reality Azure Repos
22 /
Using events and messages in Azure Pipelines
your application Azure Test Plans
Azure Artifacts
Chapter 2: Connecting
your app with data 72 /
What can Azure do for Chapter 5: Connect your
98 /
your data? business with IoT Chapter 8: Azure in Action
Where to store your data
Azure Cosmos DB How can Azure connect, secure, Walk-through: Azure portal
Azure SQL Database manage, monitor, and control your Walk-through: Developing a web
Azure databases for MySQL, devices in the cloud? app and database
PostgreSQL, and MariaDB Azure IoT Hub Walk-through: Extending apps
Azure Storage Azure IoT Central Walk-through: Ready for production
Azure data analytics Azure IoT solution accelerators
Azure IoT Edge
119 /
solutions
Walkthrough: Publish an on- Azure Digital Twins
premises website to Azure with a Azure Sphere
SQL database Learn more about Azure IoT Chapter 9: Summary
What to use, and when? and resources
The
This guide is designed for developers and
architects who are starting their journey into
Microsoft Azure. In this guide, we’ll take you
through the ins and outs of Microsoft Azure.
Developer’s
You’ll learn how to get started and which
services you can use for the scenarios you
might have.
Azure
does the heavy lifting for you. Azure services
are designed to work together so you can build
complete solutions that last the lifetime of
your app.
May The Developer’s 4
2019 Guide to Azure
With our support plans, you’ll get access to Azure Service License Agreements (SLAs), which can
technical support teams, guidance for cloud design, inform you about our uptime guarantees and
and assistance with migration planning. You can downtime credit policies.
even acquire a support plan that guarantees a
@AzureSupport on Twitter, which is operated by
response from the technical support teams within
skillful Azure engineers who respond quickly to
15 minutes.
issues that you tweet to them.
01 /
Mus ma dolor Duntiaspel is vel estotatem qui qui sitatio
nsedit, ea sere volor molupta dolut officto
Getting
You’ve made the decision to build applications
dolum earum minctur simillab is arum quatinverro
on Azure, and now you want to get started.
te destibus, tem adis eum rehenia si
You don’t need to do much—just sign up for an
omnimusam
Azure free veniincludes
account. This nossita.credits to explore
started
paid Azure services and over 25 services you can
use for free forever.
with
Simply choose which tools, applications, and
frameworks you want to use, and then start running
your apps on Azure.
Azure
May The Developer’s 6
2019 Guide to Azure
• A cloud platform
• Developer tools
• Management services
your application Web Apps: As one of the most widely used Azure
services, Web Apps can host your web applications
or APIs. A web app is basically an abstraction of a
web server, like Internet Information Services (IIS)
Azure offers services designed to provide what or Tomcat, used to host HTTP-driven applications.
you need to deliver and scale every application. Web Apps can host applications written in .NET,
When you use Azure services to run your Node.js, Python, Java, or GO, and you can use
application, you get scalability, high availability, available extensions to run even more languages.
a fully managed platform, and database services.
Azure also offers the following options
// Try it out: Create an ASP.NET
for running your application. Core web app in Azure
You can host your applications in a fully managed applications with Mobile Apps. When you host
application platform loved by enterprise an API in Mobile Apps, your mobile applications
developers: Azure App Service. Azure App Service connect with it through the cross-platform
is a collection of hosting and orchestrating services client SDK. This is available for iOS, Android, and
that share features and capabilities. All services in Windows. Mobile Apps provides features like offline
App Service have the capability, for example, to sync and push notifications to help you create a
secure an application using Azure Active Directory modern, performant, and secure mobile experience.
Azure App
You can even use Azure’s Testing in Production
feature to route a percentage of traffic from your
Service features
production app to a deployment slot. For example,
if you shunt 10 percent of your users to the new
version of your app in the deployment slot, you can
see whether the new features are functioning as
expected and whether users are using them.
Azure App Service is one of the key services in
Azure that you can use to host your applications. When you’re satisfied with how the new version of
Each of these services brings unique capabilities to your app is performing in the deployment slot, you
the table, but they all share some common features: can carry out a “swap,” which exchanges the app in
the deployment slot with that in your production
Scaling slot. You can also swap from a development slot to a
staging slot, and then to the production slot. Before
Azure App Service runs on App Service plans, doing this, the swap operation verifies that the new
which are abstractions from virtual machines (VMs). version of your website is warmed up and ready
One or more VMs run your Azure App Service, but to go. When this has been confirmed, the swap
since Azure takes care of them, it’s not necessary for operation switches the slots, and your users now see
you to know which ones. You can, however, scale the new version of the app—with no downtime. You
the resources that run your Azure App Service. can also swap back and revert the deployment of
the new version.
You can either choose a higher pricing tier (ranging
from free to premium) or increase the number of You use deployment slots within environments,
application instances that are running. It’s even such as development, test, or production. You don’t
possible to have even have Azure App Service use deployment slots as environments, because
automatically scale the number of instances for you, they all reside in the same App Service plan.
based on a schedule or metrics like CPU, memory,
or HTTP queue length. Those should be separated for security, scaling,
billing, and performance. You can swap deployment
Deployment slots slots manually through the Azure command-line
interface (CLI) and through the Azure Management
After deploying a new version of your application API. This allows tools like Azure DevOps to perform
to a deployment slot, you can test whether it swap operations during a release.
works as expected and then move it into your
production slot.
May The Developer’s 9
2019 Guide to Azure
You can connect external resources like data stores In a multitier web application, you often have a
to your App Services. These resources don’t need database or services used by your app in Web Apps.
to be located in Azure; they can be anywhere, Ideally, you want these services to be exposed only
such as on-premises or in your own datacenter. to the app and not to the internet. Given that it
Depending on your requirements, you can connect provides the entry point for your users, however,
to services on-premises through many mechanisms, the app itself is often internet-facing.
such as Azure Hybrid Connections, Azure Virtual
To isolate these support services from the internet,
Networks, and Azure ExpressRoute.
you can use Azure Virtual Network.
May The Developer’s 10
2019 Guide to Azure
This service wraps your support services and The debugger lets you see exactly what went wrong
connects them to your app in Web Apps so that the without impacting the traffic of your production
support services are exposed only to the app, not to application. The Snapshot Debugger can help you
the internet. dramatically reduce the time it takes to resolve
issues that occur in production environments.
This article describes this service in more detail and
Additionally, you can use Visual Studio to set snap
shows you how to use it.
points to debug step by step.
Sometimes, you want even more control. Maybe
you want your app to be wrapped in a Virtual Automatic OS and .NET
Network in order to control access to it. Framework patching
Perhaps you want it to be called by another app in Because you’re using a fully managed platform, you
Web Apps and be a part of your back end. don’t manage your own infrastructure at all and
benefit from automatic operating system (OS) and
For this scenario, you can use an Azure App Service framework patching.
Environment. This affords you a very high scale and
gives you control over isolation and network access. Virtual machines
Azure
An application that uses Functions activates
a function every time a new image file is
Functions
uploaded to Azure Blob storage. The function
then resizes the image and writes it to another
Blob storage account.
Azure
The following is an example of a workflow in
Logic Apps:
You can orchestrate business logic with 2. Using the data in the email, the Logic App
Logic Apps by automating a business process checks on the availability of the ordered item
or integrating with software as a service (SaaS) in SQL Server.
applications. Just like in Azure Functions, Logic
Apps can be activated by an outside source, for 3. Using Twilio, the Logic App sends a text
instance, a new message. Weaving together API message to the customer’s phone indicating
calls to connectors, you can create a (possibly that the order was received and the item has
complex) workflow that can involve resources both been shipped.
in the cloud and on-premises.
Azure Batch
If you need to run large-scale batch or high-
performance computing (HPC) applications on
VMs, you can use Azure Batch. Batch creates and
manages a collection of thousands of VMs, installs
the applications you want to run, and schedules
jobs on the VMs. You don’t need to deploy and
manage individual VMs or server clusters; Batch
schedules, manages, and auto-scales your jobs so
you use only the VMs you need.
Containers
your clusters, not for the masters. As a managed
Kubernetes service, AKS provides automated
Kubernetes version upgrades and patching, easy
cluster scaling, a self-healing hosted control plane
(masters), and cost savings, since you only pay for
While much more lightweight, containers are
running agent pool nodes.
similar to VMs, and you can start and stop them in
a few seconds. Containers also offer tremendous
With Azure handling the management of the nodes
portability, which makes them ideal for developing
in your AKS cluster, there are many tasks that you
an app locally on your machine and then hosting it
don’t have to perform manually, such as cluster
in the cloud, in test, and later in production.
upgrades. Because Azure handles these critical
maintenance tasks for you, AKS does not provide
You can even run containers on-premises or in
direct access (such as with SSH) to the cluster.
other clouds—the environment that you use
on your development machine travels with your
container, so your app always runs in the // More info: Learn how to use
Azure Kubernetes Service
same ecosystem.
Azure Kubernetes Service (AKS) makes it simple to You can host your container using Azure Container
create, configure, and manage a cluster of VMs that Instances (ACI). ACI provides fast, isolated compute
are preconfigured to run containers. This means to meet traffic that comes in spikes, without the
you can use your existing skills to manage and need to manage servers. For example, Azure
deploy applications that run in containers on Azure. Container Service (ACS) can use the Virtual
Kubelet to provision pods inside ACI that start in
AKS reduces the complexity and operational seconds. This enables ACS to run with just enough
overhead of managing a Kubernetes cluster by capacity for an average workload. As you run
offloading much of that responsibility to Azure. As out of capacity in your ACS cluster, you can scale
a hosted Kubernetes service, Azure handles critical out additional pods in ACI without any additional
tasks like health monitoring and maintenance. In servers to manage. The ACI service is billed
addition, you pay only for the agent nodes within per second, per virtual CPU, per gigabyte, or
by memory.
What to use,
Some of the services that run your application in
Azure can work together in a solution, while others
and when?
are more suited to different purposes.
Table 1-1
Web Apps*
Containers*
Web App for
Mobile Apps*
Functions*
Logic Apps*
Machines*
Virtual
Service*
Kubernetes
Service Fabric*
Instances*
Container
Batch*
Monolithic and
N-Tier applications ● ●** ● ●
Mobile app
back end ● ●**
Microservice
architecture ● ● ●
applications
Business process
orchestration ● ●
and work flows
Compute
intensive jobs ●
* Services with an asterisk have a free tier that you can use to get
started at no cost.
Making your
Azure Traffic Manager scales across regions,
helping to reduce latency and provide users
application more
a performant experience, regardless of where
they are. Traffic Manager is an intelligent routing
mechanism that you put in front of your Web
After your application is up and running in When users access your application, Traffic
Azure, you want it to be as performant as possible. Manager routes them to the Web Apps application
Azure provides a range of services that can help that is most performant in their proximity.
you with that.
Including Traffic Manager in your architecture
Azure Traffic Manager is a great way to improve the performance of
your application.
Many modern applications have users all over
the world. Providing a performant experience for
everyone is challenging, to say the least. The most
obvious problem you need to deal with is latency,
the time it takes for a signal or a request to travel
to a user. The farther away users are from your
application, the more latency they experience.
May The Developer’s 18
2019 Guide to Azure
Azure
Azure Front Door can help. This service can
route traffic from users to the most performant
Front Door
application endpoint for them to improve
performance. Azure Front Door can route to
endpoints that are available while avoiding
endpoints that are down.
Your users might be spread out over the world and Azure Traffic Manager does this as well, but in a
at times might be traveling. This can make it difficult different manner than Azure Front Door. Azure
to make sure they have a performant experience Front Door works at OSI layer 7 or the
and that your application is available and secure, HTTP/HTTPS layer, while Azure Traffic Manager
regardless of location. works with DNS. In other words, Azure Front
Door works on the application level and Azure
Traffic Manager works on the network level. This
is a fundamental difference that determines the
capabilities of the services.
Azure Content
Not only is this easy to do, it also improves
the performance of your application in the
Delivery Network
following ways:
02 /
Mus ma dolor Duntiaspel is vel estotatem qui qui sitatio
nsedit, ea sere volor molupta dolut officto
Connecting
dolum earum minctur simillab is arum quatinverro
te destibus, tem adis eum rehenia si
omnimusam veni nossita.
your app
with data
May The Developer’s 23
2019 Guide to Azure
Where to store
your data
Azure provides many types of data stores that can All services have a free tier that you can use
help you maintain and retrieve data in any scenario. to get started.
Table 2-1 presents the storage options available
in Azure.
// Note: You can use almost all
storage options mentioned in
this section as activators and
bindings for Azure Functions.
Table 2-1
DB*
Azure Cosmos
Warehouse*
SQL Database*
MySQL*
PostgreSQL*
MariaDB*
Blob*
Table*
Queue*
File*
Disk*
SQL Data
Relational data ● ● ● ● ● ●
Unstructured data ● ● ●
Semi-structured data ● ●
Queue messages ●
Files on disk ●
* Services with an asterisk have a free tier that you can use to get started at no cost.
May The Developer’s 25
2019 Guide to Azure
Azure Cosmos DB
In addition to all these features, Azure Cosmos DB
offers different APIs with which you can store and
retrieve data, including SQL, JavaScript, Gremlin,
MongoDB, Azure Table Storage, and Apache
Cassandra. Different APIs handle data in different
Azure Cosmos DB is a new kind of ways. You can use documents as data as well as
database made for the cloud. Its key unstructured tables, graphs, and blobs. You use the
features include: API that fits your needs, and Azure Cosmos DB takes
care of the rest.
• A 99.99 percent SLA (99.999% for read
operations) that includes low latencies (less than
You benefit from cloud-grade performance,
10 ms on reads and less than 15 ms on writes)
scalability, and reliability while using the
programming model you’re already accustomed to.
• Geo-replication, which replicates data to other
geographical regions in real time.
// Try it out: Get started with
Azure Cosmos DB
• Tunable data consistency levels so you can
enable a truly globally distributed data system.
You can choose from a spectrum of data
consistency models, including strong consistency,
session consistency, and eventual consistency.
Azure SQL
• Auditing, which provides a complete
audit trail of all the actions that happen
Database
to the data
Azure databases
Azure provides MySQL, PostgreSQL, and MariaDB
databases as managed databases, which means
for MySQL,
that you just spin them up and don’t have to worry
about any of the underlying infrastructure. Just like
Azure SQL Database and Azure Cosmos DB, these
The five Azure Storage types are Blob, Table, Queue, Blob storage
File, and Disk (Figure 2-1).
Azure Blob storage stores large, unstructured
data—literally, blobs of data. This data can be
video, image, audio, text, or even virtual hard drive
(VHD) files for VMs.
Queue
There are three types of blobs: Page, Append,
Blob Table
Unstructured Semi-structured Queue and Block Blobs. Page Blobs are optimized for
Large Flexible scheme Reliable
MSMQ
random read and write operations, and are perfect
Page/Block Small messages
for storing a VHD. Block Blobs are optimized for
efficiently uploading large amounts of data.
File Disk
File share Premium High I/O
SMB VM Disks
Figure 2-1
May The Developer’s 29
2019 Guide to Azure
These are perfect for storing large video files that File storage
don’t change often. Append Blobs are optimized for
append operations, such as storing operation logs You can use Azure File storage as a drive to share
that can’t be updated or deleted. files from. It uses the Server Message Block (SMB)
protocol, meaning you can use it with Windows and
// Try it out: Get started with Linux and access it from either the cloud or on-
Azure Blob storage
premises systems. Like the other services in Azure
Storage, File storage is scalable and inexpensive.
Table storage
// Try it out: Get started with
Azure Table storage is an inexpensive, extremely Azure File storage
fast NoSQL key-value store you can use to store
data in flexible tables. A table can contain one row Disk storage
describing an order and another row describing
customer information. You don’t need to define a Azure Disk storage is similar to File storage but
data schema, making Table storage very flexible. is specifically meant for high I/O performance.
It’s perfect for use as a drive in a VM that needs
// Try it out: Get started with high performance to run SQL Server, for instance.
Azure Table storage
Disk storage is available only in the premium
pricing tier of Azure Storage.
Queue storage
Azure Data Lake Store
Azure Queue storage is an unusual type of storage.
While it’s used to store small messages of data,
The previous data stores were meant for regular
its main purpose is to serve as a queue. You put
application use or for use with VMs. The Azure
messages on the queue and other processes pick
Data Lake Store, on the other hand, is storage for
them up. This pattern decouples the message
big data applications. You can use it to store large
sender from the message processor, resulting in
amounts of data in its native format—structured,
performance and reliability benefits. Azure Queue
unstructured, or anything in between. The point of
storage is found in previous versions of Windows.
the Data Lake Store is to hold your raw data so you
can analyze it or transform and move it.
// Try it out: Get started with
Azure Queue storage
May The Developer’s 30
2019 Guide to Azure
The following are the main characteristics of in predefined schemas and query it by using the
Azure Data Lake Store: familiar SQL Server dialect.
• Unlimited storage capacity. A single file can be Because SQL Data Warehouse runs in Azure, there
larger than one petabyte in size—200 times are many advanced features available to you. One
larger than other cloud providers offer. of these features is automatic threat detection,
which uses machine learning to understand the
• Scalable performance to accommodate massively patterns of your workload and serve as an alarm
parallel analytics. system to alert you of a potential breach.
• Data can be stored in any format, without An effective time to use SQL Data Warehouse is
a schema. when you know which reports you want to show
to users and what the data schema for these
This is a very different approach from the reports is. You can then create schemas in SQL Data
traditional data warehouse, in which you Warehouse and populate it with data so users can
define data schemas upfront. navigate through the data.
You can store all of the data that you get from // Try it out: Create an Azure SQL
Internet of Things (IoT) devices collecting Data Warehouse
temperature data, for example, in Data Lake
Storage. You can leave the data in the store and
then filter through it to create a view of the data
per hour or per week. Storing the data in Data Lake
Storage is inexpensive, so you can keep years of
data there at a very low cost.
Azure data
When you move data, you can also filter it before
you send it to an end destination, clean it up, or
analytics
transform it with an activity in the pipeline like
the Apache Spark activity. In addition, Azure
Data Factory allows you to schedule and monitor
Azure SQL Database, Azure SQL Data Warehouse, Azure Stream Analytics
and many other services as data sources for the
model. You can also use data sources like on- You can use the Azure Stream Analytics service
premises Active Directory, Access databases, and to analyze, query, and filter real-time streaming
Oracle databases. data. For example, when you receive a stream of
temperature data from an IoT device, it tells you
// Try it out: Create an Azure how warm it is outside. It might provide the same
Analysis Services server using temperature every second for an hour until the
the Azure portal temperature changes, but you are only interested in
the changes. Azure Stream Analytics can query the
Azure Data Lake Analytics data in real time and store only the differential data
in an Azure SQL Database.
Another Azure service for performing data analytics
tasks is Azure Data Lake Analytics. With this Stream Analytics can get its data from many
service, you can analyze, process, and transform services, including Azure Blob storage, Azure Event
potentially massive amounts of data from Azure Hubs, and Azure IoT Hub. You can analyze the data
Storage and Azure Data Lake Store. by using a simple SQL-like language or custom
code. After querying and filtering the stream of
Azure Data Lake Analytics allows you to create and data, Stream Analytics can output the result to
submit jobs that query data, analyze it, or transform many Azure services, including Azure SQL Database,
it. You can write these jobs in U-SQL, which is a SQL- Azure Storage, and Azure Event Hubs.
like language, and extend U-SQL with Microsoft R
and Python. // Try it out: Create a Stream
Analytics job using the
You pay for the jobs that you submit and run, and Azure portal
the service scales automatically depending on the
power that the jobs need. Azure Data Lake Analytics Azure Time Series Insights
is typically used for long-running analytics jobs
against massive amounts of data. You can use Azure Time Series Insights to get quick
insights on large amounts of typically IoT-type data.
// Try it out: Create your first This service gets data from Azure Event Hubs, IoT
U-SQL script through the Hub, and your own reference inputs, and it retains
Azure portal that data for a specified amount of time.
May The Developer’s 33
2019 Guide to Azure
With Azure Time Series Insights, users can query Azure Data Lake Store. Databricks also works with
and analyze data through a visualization tool as data from Azure SQL Data Warehouse, Azure SQL
soon as it comes in. Time Series Insights not only Database, and Azure Cosmos DB. Additionally, you
analyzes data, but also ingests and holds it for a can plug Databricks into Power BI to create and
while. This is like Azure Analysis Services, where show powerful dashboards.
data lives in-memory in a model for users to query.
The key differences are that Time Series Insights // Try it out: Run a Spark job on
is optimized for IoT and time-based data, and it Azure Databricks using the
contains its own data visualization tool. Azure portal
In addition to Spark-based analytics, Databricks Most of the specialized open-source data analytics
provides interactive notebooks and integrated cluster types in Azure HDInsight use Azure Blob
workflows and workspaces you can use to storage or Azure Data Lake Store to access or
collaborate with the entire data team, including store data, as these services work with the
data scientists, data engineers, and business Hadoop File System.
analysts—all of whom have access to specialized
tools for their specific needs. You can run potentially massive specialized
clusters of different types, such as an Apache
Databricks is fully integrated with Azure Active Hadoop cluster. This enables you to process and
Directory, which gives you the ability to implement analyze data with Hadoop tools like Hive, Pig,
granular security. With Databricks, you can perform and Oozie.
Spark-based data analytics on data that comes
from many places, including Azure Storage and
May The Developer’s 34
2019 Guide to Azure
You can also spin up an Apache HBase cluster, Kafka, which is a publish-subscribe messaging
which provides a very fast NoSQL database. The system used to build applications with
data actually lives within Azure Storage or an queueing mechanisms.
Azure Data Lake, but HBase provides an abstraction
layer on top, which has its own functionality and There are more cluster types, as well as tools that
unique performance. you can use within clusters. You can perform
almost any data analytics and processing task with
You can create an Apache Storm cluster, which a combination of these clusters, and they all run
is geared toward analyzing data streams, just managed in the cloud. Table 2-2 can help you pick
like Azure Stream Analytics. In addition, you can the right Azure services for analyzing your data.
have an Apache Spark cluster, which provides a
framework for processing and analyzing massive // Try it out: Extract, transform,
amounts of data. HDInsight can also run a cluster and load data using Apache Hive
for Microsoft Machine Learning Server (previously on Azure HDInsight
Microsoft R server).
Table 2-2
Data Factory*
Analysis Services*
Stream Analytics*
Azure Databricks*
Azure HDInsight*
Transform data ● ● ● ● ● ● ●
* Services with an asterisk have a free tier that you can use to get started at no cost.
May The Developer’s 35
2019 Guide to Azure
Publish an on-
• Microsoft Visual Studio 2017 or later
premises website •
this demo script
to Azure with a
SQL database
Walk through: Migrating a .NET app to Azure without
code change
Rewards clone
Publish app
May The Developer’s 37
2019 Guide to Azure
Publish options
Create profile
May The Developer’s 38
2019 Guide to Azure
Publish app
May The Developer’s 39
2019 Guide to Azure
Publish Succeeded
Web app
Further reading
03 /
Mus ma dolor Duntiaspel is vel estotatem qui qui sitatio
nsedit, ea sere volor molupta dolut officto
Securing
dolum earum minctur simillab is arum quatinverro
te destibus, tem adis eum rehenia si
omnimusam veni nossita.
your
application
May The Developer’s 41
2019 Guide to Azure
How can
Azure help
secure your app?
Have you ever had a security incident with one of
your applications? You might have had one without
even knowing it. With Azure, you can protect
data, apps, and infrastructure with built-in security
services that include security intelligence to help
identify rapidly evolving threats early—so you can
respond quickly.
somewhere, implement password management, These secrets can include the credentials in a
create a secure authentication handshake, and connection string. Your application would get the
so on. connection string from Key Vault instead of from
the configuration system. This way, administrators
Azure Active Directory (Azure AD) provides all can control the secrets, and developers never need
of these things and more out of the box. You store to deal with them. Key Vault also stores SSL and
your user identities in Azure AD and have users other certificates used to secure the traffic to and
authenticate against it, redirecting them to your from your applications over HTTPS.
application only after they’re authenticated.
Azure AD takes care of password management,
Azure Sentinel
including resolving common scenarios like
forgotten passwords.
To get a good overview of the security status of
your organization and all of its users, applications,
Since Azure AD is used by millions of applications
services, and data, you can use a security
every day—including the Azure portal, Outlook.
information and event manager (SIEM) platform.
com, and Office 365—it’s able to more readily
Azure now offers an AI-powered SIEM in the form
detect and act on malicious behavior. For instance,
of Azure Sentinel.
if a user were to sign in to an application from
a location in Europe and then one minute later
Use Azure Sentinel to collect data from your
sign in from Australia, Azure AD would flag this as
organization, including data about users,
malicious behavior and ask the user for additional
applications, servers, and infrastructure assets
credentials through multifactor authentication.
like firewalls and devices running in the cloud and
on-premises. It’s easy to collect data from your
Azure Key Vault organization with the built-in connectors. As data
is being collected, Azure Sentinel detects security
As part of your security architecture, you need a
threats and minimizes false positives with its smart
secure place to store and manage certificates, keys,
machine learning algorithms.
and other secrets. Azure Key Vault provides this
capability. With Key Vault, you can store the secrets
When there’s a threat, you’ll be alerted and
that your applications use in one central location.
can investigate it with AI, utilizing decades of
cybersecurity work at Microsoft. You can respond
// Try it out: Get started with to incidents with Azure Sentinel’s built-in workflow
Azure Key Vault
orchestration and task automation.
APIs should be secure. This is true for APIs Azure AD Application Proxy provides single
you create yourself as well as those from third-party sign-on (SSO) and secure remote access for web
vendors. To assist in making your APIs secure, applications hosted on-premises. Apps you’d likely
you can use Azure API Management. This is want to publish include SharePoint sites, Outlook
basically a proxy you put in front of APIs that adds Web Access, or other line-of-business (LOB) web
features like caching, throttling, and authentication applications. These on-premises web apps integrate
or authorization. with Azure AD, the same identity and control
platform used by Office 365. End users can access
With API Management, you secure an API by your on-premises applications the same way they
requiring users to create a subscription to it. This access Office 365 and other SaaS apps integrated
way, applications need to authenticate before they with Azure AD.
can use your API. You can use various authentication
methods like access tokens, basic authentication, Managed Identities for Azure resources
and certificates. Additionally, you can track who’s
calling your API and block unwanted callers. How do you keep credentials out of your code
completely? You can start by using Azure Key Vault,
Much more than security but where do you store the credentials to connect
to Key Vault? Managed Identities for Azure
While security is critical, Azure API Management resources provides a solution.
offers other capabilities that can help streamline
your development and testing workflow, such as You can use Managed Identities for a lot of services
test data response mocking, publishing multiple in Azure, including Azure App Service. You simply
API versions, introducing non-breaking changes enable Managed Identity with a button to inject
safely with revisions, and giving developers access credentials into your application at runtime, and
to your API’s auto-generated documentation, then use those credentials to access other services
catalog, and code samples. like Azure Key Vault. All authentication between
services is done on the infrastructure level, meaning
// Try it out: Get started with your application doesn’t have to deal with it and can
Azure API Management just use other services.
Encryption
• SQL Transparent Data Encryption (TDE) encrypts
SQL Server, Azure SQL Database, and Azure SQL
Data Warehouse data files. Data and log files are
encrypted using industry-standard encryption
algorithms. Pages in a database are encrypted
Default encryption of data
before they’re written to disk and decrypted
when they’re read.
By default, your data is encrypted in Azure when
stored in Azure SQL Database, Azure SQL Data
• SQL Always Encrypted encrypts data within
Warehouse, Azure Database for MySQL, Azure
client applications prior to storing it in Azure SQL
Database for PostgreSQL, Azure Storage, Azure
Database. It allows delegation of on-premises
Cosmos DB, or Azure Data Lake Store. All this
database administration to third parties, and
encryption works automatically, and you don’t need
maintains separation between those who own
to configure anything when you use it.
and can view the data and those who manage it
but should not access it.
To help meet your security and compliance
requirements, you can use the following features
• Azure Cosmos DB requires no action from you—
to encrypt data at rest:
user data stored in Azure Cosmos DB in non-
volatile storage (solid-state drives) is encrypted by
• Azure Disk Encryption encrypts Windows and
default, and there are no controls to turn it on
Linux infrastructure as a service (IaaS) VM boot
or off.
and data volumes using customer-managed keys.
Azure Security
You don’t have to do anything to enable the Basic
tier—it’s automatically enabled for every customer
Center
as part of the Azure platform. This service protects
your applications against the most common DDoS
attacks by performing real-time monitoring and
mitigation, and it provides the same defenses used
by Microsoft Online Services (MOS).
Azure Security Center provides unified security
management and advanced threat protection The Standard tier provides additional mitigation
across hybrid cloud workloads. It offers centralized capabilities that are tuned specifically to Azure
policy controls to limit exposure to threats and Virtual Network resources. It’s simple to enable,
rapidly find and fix vulnerabilities. and you don’t have to change your applications—
everything is done at the network level. Plus, with
In addition, Security Center supports integration the Standard tier you can customize the Basic tier
with third-party solutions and can be customized protection with your own policies that focus on your
with automation and programming capabilities. specific use cases and applications.
You can use Security Center to analyze the security
state of your compute resources, virtual networks, // More info: Read more about
storage and data services, and applications. Azure DDoS protection
You’ve heard about it on the news, and you Because the traffic is encrypted, it’s secure—even
certainly don’t want it to happen to your enterprise: when it travels over the public internet. VPN
an application is targeted by a Distributed Denial Gateway can send encrypted traffic between Azure
of Service (DDoS) attack. These types of attacks virtual networks over the Microsoft network.
are becoming more common and can overwhelm You can also create encrypted Point-to-Site (P2S)
your application to the point that no one can use connections from your computer to Azure. This way,
it anymore. The Azure DDoS protection service you have your own private, secured connection to
offers protection from DDoS attacks through a free Azure even when you’re on the road.
tier (Basic) and a paid tier (Standard).
May The Developer’s 46
2019 Guide to Azure
Azure Application Gateway is a dedicated virtual Its many diagnostic and visualization tools can help
appliance that provides an application delivery you understand and gain deeper insights into your
controller (ADC) as a service. It offers various Layer 7 network in Azure.
load balancing capabilities for your application, and
allows customers to optimize web farm productivity Examples include:
by offloading CPU-intensive SSL termination to the
application gateway. The gateway also provides • Topology: Provides a network-level view showing
other Layer 7 routing capabilities, including round- the various interconnections and associations
robin distribution of incoming traffic, cookie-based between network resources in a resource group.
session affinity, URL path-based routing, and the
ability to host multiple websites behind a single • Variable packet capture: Captures packet data in
application gateway. and out of a VM. Advanced filtering options and
fine-tuned controls, such as the ability to set time
Azure Web Application Firewall and size limitations, provide versatility. The packet
data can be stored in a blob store or on the local
You need to secure your application against
disk in .cap format.
many threats, including SQL injection, Cross-site
scripting (XSS), and others defined in the Open
• IP flow verify: Checks if a packet is allowed or
Web Application Security Project (OWASP). A WAF
denied based on 5-tuple flow information and
from Azure can lend a hand with that. A feature
packet parameters (destination IP, source IP,
of the Azure Application Gateway service, a WAF
destination port, source port, and protocol). If the
provides real-time protection of your application.
packet is denied by a security group, the rule and
It detects malicious attacks, as defined in the
group that denied the packet are returned.
OWASP core rule set, and blocks those attacks
from reaching your application. It also reports on
attempted or ongoing attacks so that you can see
active threats to your application, providing an
extra layer of security.
May The Developer’s 47
2019 Guide to Azure
A network security group (NSG) holds a list of Azure supports two types of cross-premises VPN
security rules that allow or deny network traffic to connections: P2S VPN and S2S VPN. A P2S VPN
resources connected to Azure Virtual Networks. connection lets you create a secure connection
NSGs can be associated to subnets, individual VMs to your virtual network from an individual client
(classic-style VMs), or individual network interface computer. This type of connection is established
controllers (NICs) attached to VMs (Resource from the client computer, which is useful for
Manager–style VMs). When an NSG is associated to telecommuters who want to connect to Azure
a subnet, the rules apply to all resources connected Virtual Networks from a remote location. A P2S
to the subnet. You can restrict traffic even further by VPN is also useful when you have only a few
also associating an NSG to a VM or NIC. clients that need to connect to a virtual network.
In contrast, an S2S VPN connection is used to
Azure DNS Private Zones connect your on-premises network to an Azure
virtual network over an IPsec/IKE (IKEv1 or IKEv2)
The DNS is responsible for translating (or resolving) VPN tunnel. This type of connection requires a VPN
a service name to its IP address. Azure DNS is device located on-premises that has an externally
a hosting service for DNS domains, providing facing public IP address.
name resolution using the Azure infrastructure. In
addition to internet-facing DNS domains, Azure // More info: Read more about P2S
DNS now supports private DNS domains as a and S2S VPNs
preview feature with Azure DNS Private Zones.
Security benefits from private DNS zones include
the ability to create a split DNS infrastructure.
This enables you to create private and public DNS
zones with the same names without exposing
internal names. In addition, the use of DNS Private
Zones removes the need to introduce custom
DNS solutions that could increase the overall
attack surface with independent updating and
management requirements.
Azure ExpressRoute
monitoring
A feature of Network Watcher, Azure NSG flow
logs allow you to view information about ingress
and egress IP traffic through an NSG. Flow logs can
be analyzed to gain information and insights into
network traffic and security as well as performance
Azure Log Analytics issues related to traffic.
Azure Log Analytics helps you collect and analyze While flow logs target NSGs, they are not displayed
data generated by resources in your cloud and in the same way as other logs and are stored only
on-premises environments. It provides real-time within a storage account.
insights by using integrated search and custom
dashboards to analyze millions of records across Azure Monitor Application Insights
all your workloads and servers regardless of their
physical location. Azure Monitor Application Insights is an
extensible application performance management
Azure Monitor (APM) service for web developers on multiple
platforms. It includes powerful analytics tools to
Azure Monitor enables basic monitoring for Azure help you diagnose issues and understand what
services by collecting metrics, activity logs, and users do with your app. It works for applications on
diagnostic logs. The metrics collected provide a variety of platforms hosted on-premises or in the
performance statistics for different resources, cloud, including .NET, Node.js, and J2EE.
including the OS associated with a VM.
Application Insights integrates with your DevOps Azure security technical and
process and has connection points to a variety of architectural documentation
development tools. It can monitor and analyze
telemetry from mobile apps by integrating with Azure maintains a large library of security technical
Visual Studio App Center. documentation that supplements security
information with individual services. White papers,
Azure Security and Compliance Blueprint best practices documents, and checklists are
included on the Azure Security Information page.
The Azure Security and Compliance Blueprint -
HIPAA/HITRUST Health Data and AI provides Also covered are core public cloud security topics
tools and guidance to help deploy a platform as in diverse areas, including network security,
a service (PaaS) environment for compliance with storage security, compute security, identity and
the Health Insurance Portability and Accountability access management, logging and auditing, cloud
Act (HIPAA) and Health Information Trust workload protection, PaaS security, and more.
Alliance (HITRUST).
04 /
Mus ma dolor Duntiaspel is vel estotatem qui qui sitatio
nsedit, ea sere volor molupta dolut officto
Adding
dolum earum minctur simillab is arum quatinverro
te destibus, tem adis eum rehenia si
omnimusam veni nossita.
intelligence
to your
application
May The Developer’s 52
2019 Guide to Azure
What to use,
and when?
Before diving into the options for AI in Azure, let’s
look at Table 4-1, which summarizes which services
are available and their capabilities.
Table 4-1
Rendering*
Azure Search*
Services*
Azure Cognitive
Learning Studio*
Azure Machine
Learning*
Azure Machine
Anchors*
Azure Spatial
Azure Remote
Move data from store to store ●
Transform data ● ● ● ● ● ● ●
* Services with an asterisk have a free tier that you can use to get started at no cost.
May The Developer’s 54
2019 Guide to Azure
Azure Search
• User experience features like sorting and
paging search results, intelligent filtering, and
providing search suggestions.
Cognitive
Each category in the table contains multiple
services that you can use by calling an API.
Services
Some categories contain custom services, like
Custom Vision, Language Understanding, and Bing
Custom Search. These custom services provide
preconfigured machine learning algorithms,
just like the other services, and they also enable
Cognitive Services provides machine learning you to use your own data to train the model. In
algorithms, created by Microsoft, and data as addition to these services, you can use the services
a service. For most services, Microsoft has also in the Cognitive Services Labs. The labs contain
provided the data to train those algorithms. experimental services that Microsoft is trying out
For some services, you can use your own custom to see if they fit well with customer use cases. One
data to train the algorithms. such experimental service is Project Gesture, which
enables you to detect gestures like the wave of a
Cognitive Services provides an exceptionally easy hand and weave them into your user experience.
way to incorporate machine learning and AI into
your application—by simply calling APIs. Let’s take a closer look at some of
the Cognitive Services.
Table 4-2 shows which APIs are currently available.
Note that the list keeps growing.
// Try it out: Explore
Cognitive Services
All services have a free tier that you can
use to get started.
Table 4-2
Computer Vision Speech to Text Text Analytics QnA Maker Bing Web Search
Face Text to Speech Translator Text Bing Visual Search
Video Indexer Speech Translation Bing Spell Check Bing Entity Search
Content Moderator Speaker Recognition Content Moderator Bing News Search
Custom Vision Language Bing Custom Search
Understanding Bing Image Search
Bing Autosuggest
Bing Video Search
Bing Local Business
Search
* All services have a free tier that you can use to get started.
May The Developer’s 56
2019 Guide to Azure
Language Understanding how to train the model. In this example, you would
tag an image with “cumulus” or “stratus.”
Use the Language Understanding (LUIS)
service to understand what users are saying to Once you’ve uploaded enough images, you can
you on social media, in chatbots, or in speech- train your model. The more images you upload
enabled applications. For example, you can book with tags and the more training you do, the more
flights or schedule meetings. accurate your model will be.
To use the Language Understanding service, give Once you have a model that performs well, you can
it examples of what you want it to understand, like start using it by making calls to the Custom Vision
“Book a flight to Seattle” or “Schedule a meeting API and feeding it new images. When you upload
at 1pm with Bob,” and tell it which words you’re a new image, the service tells you if it recognizes it
looking for. In these examples, you might be based on the images already uploaded.
looking for the destination of the flight (Seattle) and Figure 4-1 shows an example of what the API
the time and person for the meeting (1pm and Bob). endpoint looks like.
Custom Vision
an active internet connection to use the capabilities • Performs sentiment analysis, which identifies
of the Custom Vision service; you can also run when something positive, negative, or
it locally, which provides great performance. In neutral is said or displayed.
addition, the model you run on the edge isn’t very
large—only approximately tens of megabytes— As the breadth of these functionalities shows,
because you deploy only the model and API, not Video Indexer combines many Cognitive Services,
the training data. like Speech to Text and Speaker Recognition.
Cumulatively, these services provide powerful
capabilities that make content more discoverable,
// Try it out: Create your own
Custom Vision project accessible, and valuable.
Figure 4-2
• Creates a transcript of the text in a video.
You can refine the transcript manually and As shown in the figure, Video Indexer created a
train Video Indexer to recognize industry transcript of the audio in the video. The transcript
terms like “DevOps.” can be edited and even translated into other
languages. You can also see that Video Indexer
• Tracks faces and identifies who is in a video
recognized text on the slide behind the speakers
and at what points. Video Indexer has the same
and marked it as “OCR.” You can skip to that text by
capability for audio, for which it recognizes who
clicking it. Video Indexer provides this functionality
is speaking and when.
for individual applications by embedding the
• Recognizes visual text in a video, like Cognitive Insights widget.
text on a slide, and makes that part of
the transcript. // Try it out: Upload your first
video to Video Indexer
May The Developer’s 58
2019 Guide to Azure
The QnA Maker Cognitive Service offers an easy Bing Autosuggest provides search suggestions
way to create a conversational layer over existing while you type. This enables you to give your users
data, like the frequently asked questions (FAQ) a search experience similar to using Bing or Google,
pages, support websites, and product manuals. in which search results are automated
QnA Maker helps you analyze and extract the or completed.
information and convert it into question-and-
answer pairings that can be easily managed. Provide the search text character by character to
Simply put, QnA Maker allows you to build apps Bing Autosuggest, and it quickly returns search
that can provide information to your users in a suggestions in JSON format.
conversational manner.
For instance, when you input the query text
With QnA Maker, it’s possible to create and manage “What should I search for,” the service returns the
knowledge bases using the easy-to-use QnA Maker following JSON (see page 59 for larger figure):
Portal or using REST APIs. We have simplified the
bot creation process by allowing you to easily create
a bot from your knowledge base—without the
need for any code or settings changes. See more
details here: Create a QnA bot. Of course, you can
also use QnA Maker to create a bot using the Azure
Bot Service and augment your QnA bot by adding
the Language Understanding Service. To add
personality, you can add chit-chat to your bot, and
answer commonly asked small talk scenarios out of
the box.
You pay only for the hosting of QnA Maker, not for
how many times the resulting service gets queried
by users. This contains all the suggestions. The original search
query is contained in the top of the results.
{
“_type”: “Suggestions”,
“instrumentation”: null,
“queryContext”: {
“originalQuery”: “what should I search for”
},
“suggestionGroups”: [
{
“name”: “Web”,
“searchSuggestions”: [
{
“url”: “https://www.bing.com/search?q=what+should+i+search+for&FORM=USBAPI”,
“urlPingSuffix”: null,
“displayText”: “what should i search for”,
“query”: “what should i search for”,
“searchKind”: “WebSearch”
},
{
“url”: “https://www.bing.com/search?q=what+should+i+search+for+on+bing&
FORM=USBAPI”,
“urlPingSuffix”: null,
“displayText”: “what should i search for on bing”,
“query”: “what should i search for on bing”,
“searchKind”: “WebSearch”
},
{
“url”: “https://www.bing.com/search?q=what+should+i+search+for+on+the+internet&
FORM=USBAPI”,
“urlPingSuffix”: null,
“displayText”: “what should i search for on the internet”,
“query”: “what should i search for on the internet”,
“searchKind”: “WebSearch”
},
{
“url”: “https://www.bing.com/search?q=what+should+i+search+for+today&
FORM=USBAPI”,
“urlPingSuffix”: null,
“displayText”: “what should i search for today”,
“query”: “what should i search for today”,
“searchKind”: “WebSearch”
},
{
“url”: “https://www.bing.com/search?q=what+should+i+search+for+in+dna+raw+data&
FORM=USBAPI”,
“urlPingSuffix”: null,
“displayText”: “what should i search for in dna raw data”,
“query”: “what should i search for in dna raw data”,
“searchKind”: “WebSearch”
}
]
}
]
}
May The Developer’s 60
2019 Guide to Azure
Azure Bot
Azure Bot Service makes it easy to create a bot
and provides the following support:
Azure Machine
Learning Studio
Figure 4-3
You can add intelligence to your applications with
services from Azure such as Cognitive Services. The machine learning process works as follows:
These are based on machine learning algorithms
that Microsoft created to use as a service. However, • Data contains patterns. You probably know
there are other ways to use machine learning about some of the patterns, like user ordering
in your applications. First, let’s talk about what habits. It’s also likely that there are many
machine learning is. patterns in data with which you’re unfamiliar.
The studio itself is a portal that you can use from Learning Studio, with the workflow to be executed
your web browser and that enables you to create to train a model as well as the categories of
algorithms using a drag-and-drop approach. predefined steps that can be used in the workflow.
In the studio, you can start from scratch or with When you’ve built your experiments and used them
one of the many experiments that are in the gallery, on your data to create a machine learning model,
including one for predicting length of stays in you can publish them as web services. When your
hospitals and another for anomaly detection in real- applications use the web services, they
time data streams. Use these experiments as the can send data to your model and receive your
Machine Learning Studio, you can create whatever Azure Machine Learning service works with many
algorithm you want, providing flexibility for a Azure services that can help create, train, and
variety of scenarios, like predictive analytics, data run your algorithm. You can, for instance, create
recommendations, and data classification. your algorithm in Jupyter Notebook, train it using
Azure Databricks, and deploy it on a Kubernetes
With Azure Machine Learning service, you create container cluster in Azure Kubernetes Service.
custom machine learning algorithms from scratch.
This is different from the Machine Learning // Get started with Azure
Studio, where you visually create an algorithm by Machine Learning service
connecting predefined pieces of a machine learning by using the Azure portal
algorithm. Azure Machine Learning service fully
supports open-source technologies like Google
TensorFlow, PyTorch, and scikit-learn.
tooling for AI
Using machine learning models locally on devices
(the intelligent edge) delivers a powerful advantage:
it enables you to use the local processing power
of the device without relying on an internet
connection or incurring the latency of a web service
Visual Studio Tools for AI call to get your results.
Visual Studio Tools for AI is a free Visual Studio Described earlier in the Cognitive Services section,
extension. Use it to access a range of AI services the Custom Vision service already supports
and frameworks, including the Microsoft Cognitive running on the edge. You can expect more services
Toolkit (CNTK), TensorFlow, Keras, and Caffe2. to run on the edge in the future.
Visual Studio Tools for AI allows you to To run machine learning models on the edge, you
create machine learning algorithms similarly need tooling to help you deploy the models and
to Azure Machine Learning Studio. You can use web services. The AI Toolkit for Azure IoT Edge
languages like Python, C, C++, and C# or leverage helps with this tooling by enabling you to package
one of the many samples in the machine learning machine learning models in Azure IoT Edge–
experiments gallery. compatible Docker containers and to expose those
models as REST APIs.
With Visual Studio Tools for AI, you can create
machine learning elements from Visual Studio The AI Toolkit for Azure IoT Edge contains examples
and take advantage of the power of Visual Studio for getting started and is fully open source and
to debug machine learning algorithms and train available on GitHub.
machine learning models. From Visual Studio,
you can create training jobs that can scale out
to many VMs in Azure. You can also monitor
training performance and then generate a web
service to use the machine learning model in your
applications. You can do all this without ever leaving
Visual Studio.
AI and
For example, people entering a hospital often
have difficulty getting to where they need to go.
mixed reality
With Azure Spatial Anchors, the hospital can
create a mobile app that shows digital information
in the physical hospital to guide people to various
locations. Within the app on their iOS device,
people can use the directional arrows on the
Your applications are no longer limited to a 2D hospital’s physical information boards to get to
environment. The world is now your app canvas, their destinations.
backed by spatial intelligence from things like IoT
sensors, mixed reality, and computer vision. With Another way Azure Spatial Anchors is being used
Azure mixed-reality services, you can bring data to is in a training application for nurses. Pearson
life in 3D when and where your users need it. Education has enabled nursing students and
professors to practice diagnosing and treating
Azure Spatial Anchors patients in 3D before the pressure of a real case.
Students and professors may use HoloLens
In the world of mixed reality, you can integrate devices or mobile phones and tablets running iOS
digital information within the context of your or Android.
physical environment, like a hologram of your
favorite game characters on your kitchen counter. Azure Spatial Anchors enables you to share digital
With Azure Spatial Anchors, you can place digital information and holograms that are positioned in
content in a physical location and share that with the physical world. It works with apps built on Unity,
users using your choice of devices and platforms. ARKit, ARCore, and Universal Windows Platform
(UWP) and can be used with a HoloLens device,
iOS-based devices supporting ARKit, and Android-
based devices supporting ARCore.
May The Developer’s 66
2019 Guide to Azure
With Azure Spatial Anchors, you can easily secure But this loss of detail sacrifices information needed
your spatial data and give users access through to make the right decision in many situations. With
Azure Active Directory. You can also integrate Azure Remote Rendering, 3D models are rendered
storage, AI, analytics, and IoT services into your in the cloud and streamed to devices in real time—
spatial application. with no compromise on visual quality.
// Get started by sharing Azure This enables you to keep the original quality of
Spatial Anchors across sessions the model and interact with the content on edge
and devices devices like headsets and mobile phones with every
detail intact.
Azure Remote Rendering
Using events
One way to solve this problem is to use a queue to
decouple the web application from the web service.
and messages in
The web application receives the order and writes
it in a message on a Service Bus queue. Then the
web application informs the user that the order is
Just like Event Hubs, Azure IoT Hub is built for Azure Event Grid offers a different type of
massive data ingestion. It’s specifically geared messaging—a fully managed publish and subscribe
toward handling the enormous volume of data service that hooks into almost every service
messages from devices on the Internet of Things, in Azure as well as into custom publishers and
like smart thermostats and sensors in cars. subscribers.
It has many of the same properties as Event Hubs, This is different from working with the Service Bus
like the ability to retain messages for up to seven queues and topics, for which you’d need to poll
days and replay them. the queue or topic for new messages. Event Grid
automatically pushes messages to subscribers,
What makes IoT Hub unique is that it can send making it a real-time, reactive event service.
messages to devices. It has the ability to manage
your complete IoT infrastructure—you can use it Services in and outside of Azure publish events
to register devices, report their state, manage them when a new blob is added, for example, or when
by securing and restarting them, and send data a new user is added to an Azure subscription.
to them. Azure Event Grid detects these events and makes
them available to event handlers and services that
// Try it out: Connect your device subscribe to the events, as shown in Figure 4-5.
to your IoT hub
Event handlers can be Azure Functions or Azure
Logics Apps, which can then act on the data in
the event.
Blob Storage
Azure Functions
Resource Groups
Logic App
Azure Subscriptions
Azure Automation
Event Hubs
WebHooks
Custom Topics
Figure 4-5
May The Developer’s 70
2019 Guide to Azure
Azure provides myriad options to perform You can learn more about using
messaging and to decouple applications. Which one Azure AI services in your application
should you use, and when? Table 4-4 summarizes in this free e-book:
the differences to help you choose.
// A Developer’s Guide
to Building AI Apps
Table 4-4
Service*
SignalR
Event Grid*
Event Hubs*
IoT Hub*
Topics*
queues*
Service Bus
storage*
Azure Queue
Event ingestion ● ● ●
Device management ●
Messaging ● ● ● ● ● ● ●
Multiple consumers ● ● ● ● ●
Multiple senders ● ● ● ● ● ● ●
Use for decoupling ● ● ● ● ●
Use for publish/subscribe ● ●
* Services with an asterisk have a free tier that you can use to get started at no cost.
February Lorem
May ipsum dolor sit
Theamet,
Developer’s
consectetur 72
2018 adipiscing
2019 elit Guide to Azure
05 /
Mus ma dolor Duntiaspel is vel estotatem qui qui sitatio
nsedit, ea sere volor molupta dolut officto
Connect
dolum earum minctur simillab is arum quatinverro
te destibus, tem adis eum rehenia si
omnimusam veni nossita.
your
business
with IoT
May The Developer’s 73
2019 Guide to Azure
for instance, to route incoming messages using to interact with IoT Hub. Importantly, the company
IoT Hub message routing that offers simplicity, now has control over the security of its devices and
reliability, and scalability without the complexity of can detect their status and reset them as needed.
building custom routing solutions. In addition, the company routes the data from its
GPS dongles through Azure Stream Analytics, so
Another option for integrating IoT events into only the data of GPS changes is kept. This reduces
Azure services or business applications is to use the data burden because the dongles send their
Azure Event Grid, a fully managed event routing location every second.
solution that uses a publish-subscribe model. IoT
Hub and Event Grid work together to integrate IoT Using Azure IoT Hub enabled this company to scale
Hub events into Azure and non-Azure services in and mature its business by providing first-class
near-real time. security and device management. It also opened
new opportunities to do more with devices than the
You can also create bi-directional communication company ever thought possible.
tunnels using device streams. Azure IoT Hub device
streams facilitate the creation of secure bidirectional
TCP tunnels for a variety of cloud-to-device Azure IoT Central
communication scenarios.
Azure IoT Central is a hosted IoT solutions platform
Example: Azure IoT Hub that enables you to create rich IoT applications just
by navigating through wizards.
business. Previously, the company tracked its assets configuration—IoT Central does all that for you,
by using custom code on a native phone app, which provisioning and configuring everything you need,
called a custom web service, and by polling GPS including Azure IoT Hub.
to provision new assets with new devices, and the the solution from scratch, but without the need for
company needed to enroll a new customer that had years of programming experience. If you do want
more than 2,000 assets. more control over certain areas, you can always go
deeper and tweak the solution to your needs.
Azure IoT
solution
accelerators
Azure I oT solution accelerators are a great place
to start building your IoT solution. Figure 5-1
• The IoT Edge runtime runs on each IoT Edge Once you start using Azure IoT Edge, you’ll be able
device and manages the modules deployed to to create fast applications that run machine learning
Digital Twins
the physical environment in which your IoT devices
reside with Azure Digital Twins. This service enables
you to create a graph of data that includes places,
people, and things—for instance, an office building
that contains a room with people and sensors.
In the world of IoT, you might work with many
IoT devices and sensors that function in connection With Azure Digital Twins, you can provide context
to people and objects. To really understand to data from various sources and relate them to
the data that IoT devices capture, you need to each other—for instance, the temperature and
understand the physical environment in which humidity data from sensors in the same room. This
the devices operate. allows you to query data in the context of a space
rather than from individual sensors.
For instance, if you have a temperature sensor, the
temperature data by itself doesn’t tell you that Azure Digital Twins also lets you to manage
much. However, when you know which room the permissions to data and devices in the context of
sensor is in, how large the room is, which other the physical world. You can use Azure AD to specify
devices are in the room and what data they capture, that certain users are able to access data only from
and how many people are in the room and how a certain physical location.
Azure Sphere
However, it’s complex and challenging to secure
devices with embedded microcontrollers, as
evidenced by the many security incidents with
connected devices over the last years.
Learn more
Azure IoT solutions are easy to use, and there are
many related resources, including:
about Azure IoT • Azure IoT School: This free online academy
provides comprehensive training for Azure IoT,
with a variety of courses ranging from beginner
to advanced.
and when?
Learn more about using Azure for your IoT solution
in the following free e-books:
Table 5-2
Azure IoT
Azure IoT Azure IoT
Azure IoT Hub Solution
Central Edge
accelerators
All services have a free tier you can use to get started.
*Azure IoT Hub is required to manage Azure IoT Edge deployments and devices.
February Lorem
May ipsum dolor sit
Theamet,
Developer’s
consectetur 82
2018 adipiscing
2019 elit Guide to Azure
06 /
Mus ma dolor Duntiaspel is vel estotatem qui qui sitatio
nsedit, ea sere volor molupta dolut officto
Where
dolum earum minctur simillab is arum quatinverro
te destibus, tem adis eum rehenia si
omnimusam veni nossita.
and how
to deploy
your Azure
services
May The Developer’s 83
2019 Guide to Azure
How can
Azure deploy
your services?
Azure has an option for every type of organization,
including those who need Azure to be in their
own datacenter. You can deploy your applications
either in the public Azure cloud or on-premises in
Azure Stack choose how portable your applications
should be.
Infrastructure
It’s easy to create Azure Resource Manager
templates in Visual Studio and Visual Studio Code
as Code
using Azure Resource Group project templates.
You can also generate Azure Resource Manager
templates from the Azure portal by clicking the
Automation Script button, which is available on the
menu bar of every resource in the Azure portal.
Infrastructure as Code (IaC) captures environment This creates the Azure Resource Manager template
definitions as declarative code, such as JSON for the given resource and even generates code
documents, for automated provisioning and for building the resource using the Azure CLI,
configuration. All Azure services introduced in PowerShell, .NET, and others.
this guide are based on Azure Resource Manager,
which you can use to document your environment After you have an Azure Resource Manager
as IaC thanks to Azure Resource Manager template, you can deploy it to Azure by using
templates. These templates are JSON files that PowerShell, the Azure CLI, or Visual Studio.
describe what you want to deploy and what the Or you can automate its deployment
parameters are. in a continuous deployment (CD) pipeline using
Azure DevOps.
Azure Blueprints
It’s easy to use Azure Resource Manager templates,
resource groups, user identities, and access rights
and policies to design and create a complete
infrastructure. But how do you keep all of these
things together? And how do you keep track of
which environments each piece of infrastructure has
been deployed to and which version of the artifact
is deployed now?
Containers in Azure
“Containerization” is one of those technology exact same container configuration, so you know
buzzwords flying around in the news. But that the infrastructure is the same for everybody
containers are more than just buzz—they’re as it is in production. With containers, the age-old
actually very useful for running your applications. developer’s fallback statement—“works on my
A container is basically a lightweight VM that starts machine”—now means that it will also work
and stops much faster than a traditional VM and is in production.
therefore more useful for development, testing, and
running applications in production. There are many technologies for running
containers, including Docker. Azure can run and
The major benefit of containers is that an individual manage containers with Azure Container Instances
container is always the same. You run a container and Azure Kubernetes Service. You can also run
locally when you develop your app, and then use containers in Web App for Containers and in Azure
the same container configuration in the cloud Batch. Table 6-1 shows which service you might
and everywhere else. Your entire team uses the choose for various scenarios when using containers.
Table 6-1
Azure Stack
You can run things like Azure App Service and
Virtual Machines on Azure Stack. Everything is
exactly the same as in the public cloud, except
that you’re running it on-premises. If you decide
to move to the public cloud, you can simply push
If you need your applications and data to remain
services from Azure Stack to Azure.
on-premises but still want to benefit from the
power that Azure has to offer, Azure Stack is the
Example: Azure Stack
product for you. Unique in the industry, Azure Stack
is an extension of Azure that you host in your own
To help with cruise tasks, a company that offers
environment. Essentially, it’s Azure in a box.
luxury cruise ship holidays has built various
software, including a cabin management
You use Azure Stack in the same way you use Azure,
application and a passenger management
with the same Azure portal experience and the
application. The entire cruise ship relies on these
same APIs which you can use with the Azure CLI,
applications. In the past, the applications were
PowerShell, or your favorite IDE.
running on servers carried aboard the cruise ships.
The company was forced to do it this way because
the cruise ships didn’t have a connection to the
internet for the whole journey.
Where to deploy,
and when?
If you want to deploy IaaS-based services (in If you want to deploy PaaS-based services (where
which you control the OS), consider these options: you have less control, but the platform does the
heavy lifting), consider these options:
• On-premises or anywhere else (like your local
PC or another cloud), you can use: • On-premises or anywhere else (like your local
PC or another cloud), you can use:
• Azure Stack (where you deploy services
like VMs) • Azure Stack (as you can deploy PaaS
services like App Service in Azure Stack)
• Any of the Azure container services (as
containers can run anywhere) • In the public Azure cloud, you can use:
• In the public Azure cloud, you can use: • Any Azure PaaS service that
you script as a Resource
• Containers (as containers also run in any of
Manager template
the Azure container services)
Further reading
// Effective DevOps
07 /
Mus ma dolor Duntiaspel is vel estotatem qui qui sitatio
nsedit, ea sere volor molupta dolut officto
Share your
dolum earum minctur simillab is arum quatinverro
te destibus, tem adis eum rehenia si
omnimusam veni nossita.
code, track
work, and ship
software
May The Developer’s 90
2019 Guide to Azure
How can
• Azure Pipelines
Use Azure Pipelines to create build
collaborate
code quality with manual and exploratory
testing services for your apps.
• Azure Boards
Use Azure Boards to plan, track, and discuss
work across teams.
• Azure Repos
Use Azure Repos to collaborate on code
development with free Git public and private
repositories, pull requests, and code review.
May The Developer’s 91
2019 Guide to Azure
Azure Boards
The whole planning system is optimized for working
in an agile way. It even includes Kanban boards for
managing your work your work (Figure 7-1).
Azure Repos Azure Repos uses standard Git. This means that you
can use it with any Git tool and IDE, including Visual
Studio and Visual Studio Code as well as Git for
Windows, Mac, Eclipse, and IntelliJ.
Team Foundation Version Control With TFVC on Azure Repos, everyone can download
the versions of code branches you create on the
Team Foundation Version Control (TFVC) is a server. Azure Repos also provides a rich toolset that
centralized version control system that ensures allows you to attach work items to code changes.
one source of truth is always kept on the server. It’s also possible to request and perform code
Developers usually have only one version of each reviews, so your team can discuss changes and
file on their machine, which makes it more difficult recommend updates before they’re merged into
to work offline. the main branch.
With TFVC, you can choose to work with the // Try it out: Start developing
following workspaces: and sharing your code in TFVC
using Visual Studio
Azure Pipelines
integration tools like Jenkins or Spinnaker, you can
easily bring your existing builds and pipelines to
Azure and take advantage of dynamic agent plug-
ins to reduce infrastructure requirements and costs.
Azure Pipelines works very well with Azure services Build pipeline: The build pipeline (or CI pipeline) in
to deploy your application in an Azure web app, Figure 7-2 shows a list of tasks that will be executed
for instance. It also works with any service that when this pipeline runs. The pipeline is configured
runs in any other environment, such as Google to run as soon as new changes are committed to
Cloud, Amazon, or even on-premises in your own Azure Repos. It will take the code in Azure Repos
datacenter. If you’re already using continuous (which is a Node.js app), build a Docker container
May The Developer’s 95
2019 Guide to Azure
Azure Artifacts
Follow these simple steps to use Azure Artifacts:
08 /
Mus ma dolor Duntiaspel is vel estotatem qui qui sitatio
nsedit, ea sere volor molupta dolut officto
Azure
dolum earum minctur simillab is arum quatinverro
te destibus, tem adis eum rehenia si
omnimusam veni nossita.
in action
May The Developer’s 99
2019 Guide to Azure
Walk-through #1:
The Application Insights service tiles show
information like active alerts, live data coming in,
Figure 8-2
Tiles in the Azure portal
When you find the service you want from the search down. You can also select which ones you want to
results, as shown in Figure 8-4, a wizard takes you see by expanding the favorites menu and selecting
through configuring and deploying it. the star symbol next to those categories.
.
Understanding blades
Let’s use the Azure portal to create a new VM. Once 5. Choose a name for the VM.
we’ve done so, we’ll shut it down and remove it so
that you don’t continue to pay for it. 6. Choose the disk type. SSD provides a faster VM
but is more expensive. For this walk-through,
7. Type a username.
The VM will be deployed in a resource group, a
logical container that holds resources. All Azure 8. Select Password for the authentication type.
resources reside inside resource groups. You can
9. Type a password and confirm.
manage the security of a resource group as well
10. In the Resource Group box, type a new name.
May The Developer’s 102
2019 Guide to Azure
11. Choose the location of the VM, and 14. Review the summary, agree to the terms, and
then click OK. then click Create.
12. Choose the VM size. There are many sizing It usually takes just a few minutes for the VM to
options for VMs. VM performance determines be deployed. When you navigate to the VM in the
the cost. Use the wizard to select how many Azure portal, you can configure it further and log in
cores and how much memory you want, and using Remote Desktop Protocol (RDP).
choose options based on that. In addition, there
are other features that come with size options,
such as:
• The ability to perform load balancing. When you’re finished with the VM, shut it down
and remove it by deleting the resource group
• The graphics card installed in the VM.
that we created when we generated the VM. This
This is useful if you need to execute
contains the VM and all other resources that are
substantial graphics rendering or a
automatically created. Once the resource group is
heavy computational workload.
deleted, you no longer pay for any of the resources
13. After you select the size, you can configure that you’ve used in this walk-through.
additional settings like the virtual network, IP
address, and extensions on the machine. For
now, leave everything as is and select OK.
May The Developer’s 103
2019 Guide to Azure
Developing a web To host the .NET Core application, we’ll create a new
web app in the Azure portal.
Figure 8-8
May The Developer’s 104
2019 Guide to Azure
You can run as many App Services on an App 7. Select a pricing tier. For development and test
Service Plan as you want, but note that you need to purposes, the Basic tier is sufficient.
share resources among all the App Services.
8. Click Create. The database will now be created.
To host the database, we’ll create a SQL database. 9. Navigate to the SQL database and click Show
This works the same as a local SQL Server database Database Connection String.
and now runs fully managed in Azure.
10. Make note of the connection string because
1. In the Azure portal, click Create A New Service. you’ll need it later in this tutorial.
2. Search for SQL Database and click it to open Running the .NET Core app locally
the SQL Database blade. Click Create. The
Create SQL Database blade opens. Let’s run the app locally before we run it in Azure.
The app can run locally because by default, it uses
3. Type a database name.
a SQLite database, which is a self-contained SQL
4. Select the resource group that you created for database engine.
the web app.
1. Open a command prompt and navigate to a
5. Leave the source as Blank database.
directory you want to use as your source code
6. Click Server to create a new SQL directory for this project.
database server.
2. Run the following commands to get the source
a. Type a name for the server. code and navigate to the project folder:
to the server.
dotnet run
May The Developer’s 105
2019 Guide to Azure
4. The app should now be running, and the URL to Connecting the local web app to the
the app (such as http://localhost:5000) should database running in Azure
be in the output in the command window
You now have a working application running
5. Navigate to that URL in a browser. This will load
locally. Before we deploy it to Azure, we’ll change
the application, which will look like that shown
the source code so that it can connect to the
in Figure 8-9. Now you can create new to-do
SQL database.
items by selecting the Create New link.
6. Close the application by closing the command 1. In your local source code repository, find the
window or pressing Ctrl+C. Startup.cs file and locate the following code:
servicesAddDbContext<MyDatabaseContext>
(options => options.UseSqlite
(“Data Source=localdatabase.db”));
if(Environment.
GetEnvironmentVariable(“ASPNETCORE_
ENVIRONMENT”) == “Production”)
services.
AddDbContext<MyDatabaseContext>(options =>
Figure 8-9
options.UseSqlServer(Configuration.
GetConnectionString(“MyDbConnection”)));
else
services.
AddDbContext<MyDatabaseContext>(options =>
options.UseSqlite(“Data
Source=localdatabase.db”));
This code looks at the environment in which it’s 6. Create a new connection string named
running and changes its database connection MyDbConnection. The value should be
based on that information. When running in the the connection string to the SQL database
production environment (Azure, in this case), (including username and password) you saved
the code will get the connection string for the earlier when you created the database.
database from the MyDbConnection variable,
7. Click Save. The application settings in the
which we’ll configure in Azure.
Azure portal should look like those shown in
Figure 8-10.
The code also runs the Database.Migrate()
method, which executes the Entity
Framework Core migrations that
we previously ran manually.
2. The Azure Cloud Shell enables you to use 6. Once the remote target is added to the Git
the Azure CLI in the cloud and manages repository, you can push your code to it by
authentication. When the Cloud Shell is fully running the following command. You’ll need
loaded, run the following command to create to enter credentials to be able to push code to
the deployment user. Replace the <username> Azure. Use the username and password you
and <password> values with ones you create. used to create the deployment user.
Make note of the username and password
because you’ll need them later. git push azure master
az webapp deployment user set --user-name Pushing the source code to Azure might take
<username> --password <password>
a few minutes the first time. Once complete,
navigate to the URL of your Azure web app,
3. The command results in a JSON output. If you which will look like this: http://<app_ name>.
receive a ‘Conflict’. Details: 409 error message, azurewebsites.net
change the username. If you receive a ‘Bad
7. Add some to-do items in the application to test
Request’. Details: 400 error message, create a
its connection to the database.
stronger password.
Now you have a working application
Now we’ll push the source code from the local
running in Azure.
Git repository to the Azure web app.
Walk-through #3:
We’ll set this up using the Logic Apps feature
of Microsoft Azure App Service and the
Extending
Language Understanding Intelligent Service
(LUIS), as follows:
applications with • The .NET Core app writes the to-do item in the
SQL database.
Logic Apps and • The logic app is triggered by every new row
created in the database.
Cognitive Services • The logic app takes the to-do item text
and passes it to the Language
Understanding service.
A powerful feature of our application is its ability
• The Language Understanding service analyzes
to analyze the content of to-do items and then
the text and creates a calendar item in your
automatically create calendar appointments for
Office 365 calendar if the text contains a date
tasks that include a specific date.
and time.
For example, if a user creates a to-do item We don’t have to change our application to add this
with the text “family dinner next Friday at 7:00 PM,” functionality. Logic Apps and Cognitive Services
the application will create a calendar item for that are additional services that simply analyze the data
specific Friday at 7:00 PM with the subject that’s already there.
“family dinner.”
Let’s get started.
May The Developer’s 109
2019 Guide to Azure
5. Create a new resource group 7. Type a name like “Add to-do calendar item,”
Now you can enter utterances. These are sample 15. The model is now published to production.
texts that represent the intent we want to detect. Scroll down to Resources and Keys and make
note of the key string you’ll find there because
9. Enter “family dinner next Friday at 7 PM” to
we’ll need it for our logic app.
represent the intent of adding a to-do item to
the calendar.
Creating the logic app
10. Because we’ve already added two entities,
The logic app we create will be triggered by the
the text in the utterance is analyzed and
new rows of to-do items written in SQL Database.
recognized as these entities, as shown in Figure
It will then take the value of each to-do item and
8-11. The text “family dinner” is recognized as
send it to the Language Understanding service to
a keyPhrase. The text “next Friday at 7 PM” is
be analyzed. If the Language Understanding service
recognized as datetimev2.
finds a date in the item, it will create a new calendar
11. Let’s use this model to train the service and event in your Office 365 account.
publish it. Select Train in the upper-right corner
Let’s create the logic app:
of the screen.
1. In the Azure portal, click Create A New Service.
keyPhrase datetimev2
2. Search for Logic App and click it in the search
Figure 8-11 results to open the Logic App blade. Click
Create. The Create Logic App blade opens.
• This performs machine learning training
and builds a machine learning model based 3. Type a name.
on what we’ve just entered.
4. Select the resource group that you created for
• To test if the service works as expected, the Language Understanding service.
type “family dinner next Friday at 7 PM” in
5. Choose a location.
the Test window next to the Train button.
6. Click Create.
12. Now that we have a working service, we need
to publish this model to production. Click 7. When the logic app is created, you’ll see a quick
Publish in the menu (next to the Train button) start page that asks if you want to start the
to bring up the Publish page. logic app from a template (Figure 8-12). Choose
Blank Logic App.
13. Leave the slot as Production.
We now need to create a trigger for the logic app. Now the logic app will be triggered every time we
2. Select the When an item is created task. This Next, we’ll add another action for the logic app.
will ask for the connection to the SQL database
(Figure 8-13). 1. Click the plus sign under the SQL task, and then
select Add an action to add the next action
(Figure 8-14).
Figure 8-13
3. Type a name for the connection. 16. Select the App ID as we did earlier.
4. Paste in the connection key you saved when we 17. Select builtin.datetimev2 for the desired entity.
published the Language Understanding model.
18. Select the LUIS Prediction object for the
5. Click Create. luisPredictionObject field.
6. Select the App ID that you created in the 19. Below this action, add another one for
Language Understanding portal. Get entity by type.
7. Select the description from the SQL task as the 20. Select the App ID.
input for the Utterance field.
21. Select builtin.keyPhrase for the desired entity.
8. Select the Add to-do calendar item for the
22. Select the LUIS Prediction object for the
desired intent. This will output whether the task
luisPredictionObject field.
contains a date.
23. Create a new action while still in the if true
9. Click the plus sign, and then click Add a
box. Search for Office 365 and then select the
condition. We’ll test whether the text contains a
Create Event V2 action. This can create an
date by checking if the desired intent was true.
event in your Office 365 calendar.
If the text does contain a date, we’ll create a
calendar event. If it doesn’t, we won’t 24. Note that this requires a connection to
do anything. Office 365. Click add new connection and
log in with your Office 365 credentials. The
10. In the condition, select the Is Desired Intent
logic app will keep your connection in your
value from the Language Understanding task
Azure subscription.
for the value.
25. Select the calendar to create the event.
11. Leave the is equal to statement as is.
26. In the End Time and Start Time fields, select
12. Add true in the value textbox.
the Entity Value from the action where you
13. The condition appears in both the if true filter the datetimev2 entity.
and if false boxes. In the if true box, create a
27. In the Subject field, select the Entity Value from
new action.
the action where you filter the keyPhrase entity.
14. Search for LUIS as we did earlier.
28. Save the logic app flow. The if yes box should
15. Select the Get entity by type action. This is a look similar to that shown in Figure 8-15.
Language Understanding action that extracts
29. Navigate to the to-do app URL, which
an entity based on its type from the Language
is the URL of your web app from the
Understanding results.
previous walk-through.
May The Developer’s 113
2019 Guide to Azure
Walk-through
#4: Ready for
production Figure 8-16
4. In Choose Source, select GitHub. There are deployment slots for staging, load
testing, and production, which is always the original
5. In the Authorization section, authorize Azure
App Service—in our example, the .NET Core web
to use GitHub by selecting Authorize and
app. In fact, you can have as many deployment slots
granting permission.
as you want without incurring additional costs.
6. In the Choose Project section, choose the
The deployment slots all run in the same App
GitHub repository that you just created.
Service Plan, which is what you pay for. Keep in
7. Leave the branch set to master. mind that having additional deployment slots in an
App Service Plan will consume resources like CPU
8. Click OK.
and memory.
9. Return to the Deployment Options menu. You
You create new deployment slots from the
can now see that GitHub is connected. From
Deployment Slots menu item in the web app.
this point, whenever you push a new version
You need to run the web app in the standard or
of source code to GitHub, it will be built and
premium pricing tier because the free plan doesn’t
deployed to the web app automatically. This
come with any deployment slots.
is shown in Figure 8-17, which illustrates the
Deployment Options blade. You can also force
this process by clicking Sync.
May The Developer’s 116
2019 Guide to Azure
In each deployment slot you create, you can 8. Disconnect the CD connection in the
configure the deployment options as we did earlier original .NET Core web app. This way, when
to deploy code automatically. You can even work you push new code, it’s delivered only into the
on different source code branches for different staging slot.
environments and automatically deploy specific
9. In the .NET Core app, change some text in the
branches to specific deployment slots.
Index.cshtml file in the Views/Home folder.
Additionally, you can test your final version in
10. Commit it to Git and push it to GitHub, just like
a deployment slot and then swap it with the
when you deployed the .NET Core app.
version in the production slot. This warms up
the application before it swaps, resulting in a The new version is now in the staging slot and
deployment with no downtime. not in the original web app, which we call the
production slot. You can verify this by navigating to
Let’s see how to create a deployment
the URL of the .NET Core web app and to the URL of
slot and swap to it.
the staging slot, which you can find in the Overview
1. In the Azure portal, go to the web app that blade of the slot.
hosts the .NET Core app.
Now let’s put the new version into production.
2. On the menu bar, click Deployment Slots.
1. In the Azure portal, go to the .NET
The Deployment Slots blade opens.
Core web app.
3. Click the plus sign to create a new
2. On the menu bar, select Deployment Slots to
deployment slot.
open the Deployment Slots blade.
4. Type a name for the slot, for example, “staging.”
3. Click Swap to open the Swap blade. Leave all
5. Choose the .NET Core web app as the settings as they are.
configuration source. This copies the
4. Click OK to initiate the swap.
application settings to the new slot.
Once the swap is complete, the new version of the
6. Click OK to create the slot, which is similar to
.NET Core web app is in production. You can test it
the original web app.
by navigating to the URL of the Node.js web app.
7. Set up CD for the slot, just as you did for the Using deployment slots in this way is beneficial
web app. because you can test the new version before it goes
into production and then deploy it to production
with no downtime.
May The Developer’s 117
2019 Guide to Azure
Figure 8-18
4. Type a name and select a location for the
Application Insights instance.
09 /
Mus ma dolor Duntiaspel is vel estotatem qui qui sitatio
nsedit, ea sere volor molupta dolut officto
Summary
In this guide, we introduced the
dolum earum minctur simillab is arum quatinverro
power that Azure can bring to your
te destibus, tem adis eum rehenia si
applications. Using Azure, you can do
omnimusam veni
incredible nossita.
things with your apps—
and
employ facial and speech recognition,
manage your IoT devices in the cloud,
scale as much as you want—and pay
resources
only for what you use.
Keep learning
with Azure
With your Azure free account, you get all of
this—and you won’t be charged until you
choose to upgrade:
http://www.azure.com/free
May The Developer’s 122
2019 Guide to Azure
About the
authors
Michael and Barry are passionate about Azure and Michael Crump works at Barry Luijbregts is an
Microsoft on the Azure independent software
encourage you to reach out to them on Twitter for platform and is a coder, architect and developer with
questions regarding this book. blogger, and international a passion for the cloud and
speaker on various cloud authors courses for Pluralsight.
development topics. He’s
passionate about helping You can reach Barry on Twitter
developers understand the @AzureBarry and through
benefits of the cloud in a no- his website at https://www.
nonsense way. azurebarry.com/.
Microsoft Press books are available through booksellers and distributors worldwide.
If you need support related to this book, email Microsoft Press Support at mspinput@
microsoft.com. Please tell us what you think of this book by taking this survey.
This book is provided “as-is” and expresses the author’s views and opinions. The
views, opinions and information expressed in this book, including URL and other
Internet website references, may change without notice. Some examples depicted
herein are provided for illustration only and are fictitious. No real association or
connection is intended or should be inferred.