SAFwAD @ Intelligent Cloud Conference

Rick van den Bosch
Rick van den BoschCloud Solution Architect at Betabit
Session
Rick van den Bosch
Securing an Azure Function REST API with Azure Active Directory
#SAFwAD
Session
Rick van den Bosch
@rickvdbosch
rickvandenbosch.net
rickvdbosch@outlook.com
Azure Active Directory
Azure Functions
Static website hosting
ADAL & MSAL
Putting things together
Agenda
Azure Active Directory
“Azure Active Directory (Azure AD) is
Microsoft’s cloud-based
identity and access management service.
Azure AD helps your employees
sign in and access resources”
Azure Active Directory
• Seamless, highly secure access
• Comprehensive identity protection
• Efficient management and compliance at scale
• Customer and partner identities
• Identity platform for developers
• Identity for IaaS (infrastructure as a service)
Azure Active Directory
SAFwAD @ Intelligent Cloud Conference
IT admins
App developers
Subscribers of
- Microsoft 365
- Office 365
- Azure
- Dynamics CRM online
Who uses Azure AD?
Free FREE!
Basic € 0,844 kr 6,294 user / month *
Premium P1 € 5,06 kr 37,761 user / month *
Premium P2 € 7,59 kr 56,641 user / month *
“Pay as you go” feature license.
* Annual commitment
Pricing tiers
“Azure Active Directory (Azure AD) B2C is
an identity management service
that enables you to customize and control
how customers sign up, sign in, and manage their profiles
when using your applications.
This includes applications developed for
iOS, Android, and .NET, among others.”
Azure AD B2C
Azure AD B2C - Pricing
Azure Functions
“Accelerate your development with an
event-driven, serverless compute experience.
Scale on demand and pay only for the resources you consume.”
Azure Functions
• Take advantage of serverless compute with Functions
• Manage your apps instead of infrastructure
• Optimize for business logic
• Develop your way
Azure Functions
Web application backends
Mobile application backends
Real-time file processing
Real-time stream processing
Automation of scheduled tasks
Extending SaaS applications
What you can do with Functions
Two major versions: 1.x and 2.x
Current version: 2.x
Both supported for production
Runtimes
Supported languages
Language 1.x 2.x
C# GA (.NET Framework 4.7) GA (.NET Core 2)
JavaScript GA (Node 6) GA (Node 8 & 10)
F# GA (.NET Framework 4.7) GA (.NET Core 2)
Java N/A Preview (Java 8)
Python Experimental Preview (Python 3.6)
TypeScript Experimental GA (Supported through transpiling to JavaScript)
PHP Experimental N/A
Batch (.cmd, .bat) Experimental N/A
Bash Experimental N/A
PowerShell Experimental N/A
App Service Plan
Run your functions just like your web, mobile, and API apps. When you are already using
App Service for your other applications, you can run your functions on the same plan at no
additional cost.
Consumption plan
When your function runs, Azure provides all of the necessary computational resources.
You don't have to worry about resource management, and you only pay for the time that
your code runs.
Running Azure Functions
Scaling
Scaling can vary on a number of factors
Might scale differently based on the trigger and language selected
• A single function app only scales up to a maximum of 200 instances.
• A single instance may process more than one message or request at a time.
• HttpTriggered only be allocated at most once every 1 second.
• New instances will only be allocated at most once every 30 seconds.
Scaling behavior
Long running
• Keep the runtime short (default < 5m; max. 10m)
Stateless
• Don’t use state in the host
• Idempotent
Cold start
• Fast start up times
• Keep them small
Control
• ‘They’ control scaling
• ‘They’ control when your host is alive
• You control the code!
Best practices
Pricing
• Billed based on per-second resource consumption and executions
• Execution Time: € 0.000014/GB-s
kr 0.000101/GB-s
• Total executions: € 0.169 per million executions
kr 1.259 per million executions
• Monthly free grant: 1 million executions
400.000 GB-s
Calculation resource consumption: avg. mem. Size in GB x execution time in ms.
Mem rounded to nearest 128 MB, max 1.536 MB.
Execution time rounded up to nearest 1 ms.
Minimum: 100 ms & 128 mb
Pricing – Consumption plan
Functions REST API
Table Storage
One weekend, 7 stages
Approximately 80.000 API requests
98.6% had a response time of < 250 ms
96% had a response time of < 30 ms
Total costs: € 3,14
Reference case - Cultural festival
Consumption plan++
• Enhanced performance
• VNET Access
Billed per second, based on vCPU-s and GB-s
Premium plan (preview)
Static website hosting
Available on General-Purpose V2
Special container: web$
Files in this container are:
• served through anonymous access requests
• only available through object read operations
• case-sensitive
Provided at no additional cost
Static website hosting
ADAL & MSAL
Enables application developers to authenticate users to
- Cloud Active Directory
- On-premises Active Directory
• Configurable token cache that stores access tokens and refresh tokens
• Automatic token refresh when an access token expires and a refresh token is available
• Support for asynchronous method calls
Active Directory Authentication Library (ADAL)
Enables Single Page Applications to authenticate users with
- Microsoft Azure Active Directory accounts
- Microsoft accounts
- Accounts in social identity providers like Facebook, Google, LinkedIn etc.
Interacts with
- Microsoft Azure Active Directory
- Microsoft Azure AD B2C
- Microsoft accounts
Microsoft Authentication Library (MSAL)
Preview for JS
Differences (process)
Differences (implementation)
Angular 4/5/6/7 ADAL Wrapper
Can be used to authenticate Angular applications against Azure Active Directory v1
endpoint.
Adal-angular4
Wrapper of the core MSAL.js library
Suitable for use in a production environment
The same production level support as current libraries
Changes may impact your application
When GA: update within six months
@azure/msal-angular
Putting things together
Triggers & Bindings
SAFwAD @ Intelligent Cloud Conference
Serverless abstracts away the compute
Triggers & Bindings abstract away the services you interact with
Dual abstraction
Example: Blob Trigger on a consumption plan
Up to 10-minute delay processing new blobs
Solution:
Switch to App Service plan with Always On enabled.
Use Event Grid trigger with your Blob storage account.
Triggers
public static async Task Run(
[BlobTrigger("upload/{name}", Connection = "scs")]Stream addedBlob,
string name, ILogger log)
{
// Setting up my BlobStorageRepository (it's a wrapper)
var connectionString = Environment.GetEnvironmentVariable("scs",
EnvironmentVariableTarget.Process);
var blobStorageRepository = new BlobStorageRepository(connectionString);
await blobStorageRepository.AddFileAsync("copied", name, addedBlob);
}
Bindings 1/3
Binding 2/3
public static async Task Run(
[BlobTrigger("upload/{name}", Connection = "scs")]Stream addedBlob,
[Blob("copied/{name}", FileAccess.Write, Connection = "scs")]Stream stream,
string name, ILogger log)
{
await addedBlob.CopyToAsync(stream);
}
Binding 3/3
public static async Task RunAsync(
[BlobTrigger("to-process/{name}", Connection = "scs")]Stream addedBlob,
[ServiceBus("process", Connection = "sbcss", EntityType = EntityType.Queue)]
ICollector queueCollector, string name, ILogger log)
{
using (var reader = new StreamReader(addedBlob))
{
var words = (await reader.ReadToEndAsync()).Split(' ');
Parallel.ForEach(words.Distinct(), (word) =>
{
queueCollector.Add(word);
});
}
}
Build a Serverless web app in Azure
About Microsoft identity platform
adal-angular4
@azure/msal-angular
rickvdbos.ch/safwad
Resources
SAFwAD @ Intelligent Cloud Conference
Event
partners
Expo
partners
Expo light
partners
1 of 45

Recommended

Google Cloud Dataflow by
Google Cloud DataflowGoogle Cloud Dataflow
Google Cloud DataflowGirdhareeSaran
55 views11 slides
Scaling Galaxy on Google Cloud Platform by
Scaling Galaxy on Google Cloud PlatformScaling Galaxy on Google Cloud Platform
Scaling Galaxy on Google Cloud PlatformLynn Langit
5.3K views31 slides
Compare Clouds: Aws vs Azure vs Google vs SoftLayer by
Compare Clouds: Aws vs Azure vs Google vs SoftLayerCompare Clouds: Aws vs Azure vs Google vs SoftLayer
Compare Clouds: Aws vs Azure vs Google vs SoftLayerRightScale
12.1K views34 slides
Google cloud platform introduction by
Google cloud platform introductionGoogle cloud platform introduction
Google cloud platform introductionSimon Su
2.1K views44 slides
Google Cloud Platform Introduction - 2016Q3 by
Google Cloud Platform Introduction - 2016Q3Google Cloud Platform Introduction - 2016Q3
Google Cloud Platform Introduction - 2016Q3Simon Su
1.5K views16 slides
Understanding cloud with Google Cloud Platform by
Understanding cloud with Google Cloud PlatformUnderstanding cloud with Google Cloud Platform
Understanding cloud with Google Cloud PlatformDr. Ketan Parmar
8.4K views44 slides

More Related Content

What's hot

Cosmos DB and Azure Functions A serverless database processing.pptx by
Cosmos DB and Azure Functions  A serverless database processing.pptxCosmos DB and Azure Functions  A serverless database processing.pptx
Cosmos DB and Azure Functions A serverless database processing.pptxicebeam7
152 views33 slides
MongoDB World 2016: Scaling Targeted Notifications in the Music Streaming Wor... by
MongoDB World 2016: Scaling Targeted Notifications in the Music Streaming Wor...MongoDB World 2016: Scaling Targeted Notifications in the Music Streaming Wor...
MongoDB World 2016: Scaling Targeted Notifications in the Music Streaming Wor...MongoDB
1.5K views30 slides
Migrating My.T-Mobile.com to AWS (ENT214) | AWS re:Invent 2013 by
Migrating My.T-Mobile.com to AWS (ENT214) | AWS re:Invent 2013Migrating My.T-Mobile.com to AWS (ENT214) | AWS re:Invent 2013
Migrating My.T-Mobile.com to AWS (ENT214) | AWS re:Invent 2013Amazon Web Services
2.6K views16 slides
Real-time Data Processing with Amazon DynamoDB Streams and AWS Lambda by
Real-time Data Processing with Amazon DynamoDB Streams and AWS LambdaReal-time Data Processing with Amazon DynamoDB Streams and AWS Lambda
Real-time Data Processing with Amazon DynamoDB Streams and AWS LambdaAmazon Web Services
34.6K views28 slides
Google Cloud and Data Pipeline Patterns by
Google Cloud and Data Pipeline PatternsGoogle Cloud and Data Pipeline Patterns
Google Cloud and Data Pipeline PatternsLynn Langit
6.6K views32 slides
Real-Time Event Processing by
Real-Time Event ProcessingReal-Time Event Processing
Real-Time Event ProcessingAmazon Web Services
7K views49 slides

What's hot(20)

Cosmos DB and Azure Functions A serverless database processing.pptx by icebeam7
Cosmos DB and Azure Functions  A serverless database processing.pptxCosmos DB and Azure Functions  A serverless database processing.pptx
Cosmos DB and Azure Functions A serverless database processing.pptx
icebeam7152 views
MongoDB World 2016: Scaling Targeted Notifications in the Music Streaming Wor... by MongoDB
MongoDB World 2016: Scaling Targeted Notifications in the Music Streaming Wor...MongoDB World 2016: Scaling Targeted Notifications in the Music Streaming Wor...
MongoDB World 2016: Scaling Targeted Notifications in the Music Streaming Wor...
MongoDB1.5K views
Migrating My.T-Mobile.com to AWS (ENT214) | AWS re:Invent 2013 by Amazon Web Services
Migrating My.T-Mobile.com to AWS (ENT214) | AWS re:Invent 2013Migrating My.T-Mobile.com to AWS (ENT214) | AWS re:Invent 2013
Migrating My.T-Mobile.com to AWS (ENT214) | AWS re:Invent 2013
Amazon Web Services2.6K views
Real-time Data Processing with Amazon DynamoDB Streams and AWS Lambda by Amazon Web Services
Real-time Data Processing with Amazon DynamoDB Streams and AWS LambdaReal-time Data Processing with Amazon DynamoDB Streams and AWS Lambda
Real-time Data Processing with Amazon DynamoDB Streams and AWS Lambda
Amazon Web Services34.6K views
Google Cloud and Data Pipeline Patterns by Lynn Langit
Google Cloud and Data Pipeline PatternsGoogle Cloud and Data Pipeline Patterns
Google Cloud and Data Pipeline Patterns
Lynn Langit6.6K views
AWS Architecture Case Study: Real-Time Bidding by Amazon Web Services
AWS Architecture Case Study: Real-Time BiddingAWS Architecture Case Study: Real-Time Bidding
AWS Architecture Case Study: Real-Time Bidding
Amazon Web Services10.4K views
Introduction to Google Cloud Services / Platforms by Nilanchal
Introduction to Google Cloud Services / PlatformsIntroduction to Google Cloud Services / Platforms
Introduction to Google Cloud Services / Platforms
Nilanchal 1.5K views
Introduction to Google Cloud Platform by dhruv_chaudhari
Introduction to Google Cloud PlatformIntroduction to Google Cloud Platform
Introduction to Google Cloud Platform
dhruv_chaudhari4.6K views
BDA403 The Visible Network: How Netflix Uses Kinesis Streams to Monitor Appli... by Amazon Web Services
BDA403 The Visible Network: How Netflix Uses Kinesis Streams to Monitor Appli...BDA403 The Visible Network: How Netflix Uses Kinesis Streams to Monitor Appli...
BDA403 The Visible Network: How Netflix Uses Kinesis Streams to Monitor Appli...
Amazon Web Services1.2K views
code lab live Google Cloud Endpoints [DevFest 2015 Bari] by Nicola Policoro
code lab live Google Cloud Endpoints [DevFest 2015 Bari]code lab live Google Cloud Endpoints [DevFest 2015 Bari]
code lab live Google Cloud Endpoints [DevFest 2015 Bari]
Nicola Policoro530 views
Real-time Streaming and Querying with Amazon Kinesis and Amazon Elastic MapRe... by Amazon Web Services
Real-time Streaming and Querying with Amazon Kinesis and Amazon Elastic MapRe...Real-time Streaming and Querying with Amazon Kinesis and Amazon Elastic MapRe...
Real-time Streaming and Querying with Amazon Kinesis and Amazon Elastic MapRe...
Amazon Web Services16.1K views
Microsoft Azure Cost Optimization and improve efficiency by Kushan Lahiru Perera
Microsoft Azure Cost Optimization and improve efficiencyMicrosoft Azure Cost Optimization and improve efficiency
Microsoft Azure Cost Optimization and improve efficiency
StackEngine Demo - Docker Austin by Boyd Hemphill
StackEngine Demo - Docker AustinStackEngine Demo - Docker Austin
StackEngine Demo - Docker Austin
Boyd Hemphill6.1K views
Google cloud platform Introduction - 2014 by Simon Su
Google cloud platform Introduction - 2014Google cloud platform Introduction - 2014
Google cloud platform Introduction - 2014
Simon Su1.4K views
Cncf event driven autoscaling with keda by JurajHantk
Cncf   event driven autoscaling with kedaCncf   event driven autoscaling with keda
Cncf event driven autoscaling with keda
JurajHantk97 views

Similar to SAFwAD @ Intelligent Cloud Conference

Serverless Computing with Azure Functions Best Practices by
Serverless Computing with Azure Functions Best PracticesServerless Computing with Azure Functions Best Practices
Serverless Computing with Azure Functions Best PracticesJuan Pablo
1.1K views21 slides
Azure Function Best Practice by
Azure Function Best Practice Azure Function Best Practice
Azure Function Best Practice Juan Pablo
286 views22 slides
Windows Azure Platform + PHP - Jonathan Wong by
Windows Azure Platform + PHP - Jonathan WongWindows Azure Platform + PHP - Jonathan Wong
Windows Azure Platform + PHP - Jonathan WongSpiffy
14.9K views41 slides
Durable Azure Functions by
Durable Azure FunctionsDurable Azure Functions
Durable Azure FunctionsPushkar Saraf
138 views16 slides
Azure Functions.pptx by
Azure Functions.pptxAzure Functions.pptx
Azure Functions.pptxYachikaKamra
3 views42 slides
Time Series Analytics Azure ADX by
Time Series Analytics Azure ADXTime Series Analytics Azure ADX
Time Series Analytics Azure ADXRiccardo Zamana
232 views57 slides

Similar to SAFwAD @ Intelligent Cloud Conference(20)

Serverless Computing with Azure Functions Best Practices by Juan Pablo
Serverless Computing with Azure Functions Best PracticesServerless Computing with Azure Functions Best Practices
Serverless Computing with Azure Functions Best Practices
Juan Pablo 1.1K views
Azure Function Best Practice by Juan Pablo
Azure Function Best Practice Azure Function Best Practice
Azure Function Best Practice
Juan Pablo 286 views
Windows Azure Platform + PHP - Jonathan Wong by Spiffy
Windows Azure Platform + PHP - Jonathan WongWindows Azure Platform + PHP - Jonathan Wong
Windows Azure Platform + PHP - Jonathan Wong
Spiffy14.9K views
Serverless Comparison: AWS vs Azure vs Google vs IBM by RightScale
Serverless Comparison: AWS vs Azure vs Google vs IBMServerless Comparison: AWS vs Azure vs Google vs IBM
Serverless Comparison: AWS vs Azure vs Google vs IBM
RightScale7.5K views
Microsoft Azure News - December 2019 by Daniel Toomey
Microsoft Azure News - December 2019Microsoft Azure News - December 2019
Microsoft Azure News - December 2019
Daniel Toomey75 views
Azure satpn19 time series analytics with azure adx by Riccardo Zamana
Azure satpn19   time series analytics with azure adxAzure satpn19   time series analytics with azure adx
Azure satpn19 time series analytics with azure adx
Riccardo Zamana271 views
Building stateful serverless orchestrations with Azure Durable Azure Function... by Callon Campbell
Building stateful serverless orchestrations with Azure Durable Azure Function...Building stateful serverless orchestrations with Azure Durable Azure Function...
Building stateful serverless orchestrations with Azure Durable Azure Function...
Callon Campbell120 views
Windowsazureplatform Overviewlatest by rajramab
Windowsazureplatform OverviewlatestWindowsazureplatform Overviewlatest
Windowsazureplatform Overviewlatest
rajramab654 views
AWS APAC Webinar Series: How to Reduce Your Spend on AWS by Amazon Web Services
AWS APAC Webinar Series: How to Reduce Your Spend on AWSAWS APAC Webinar Series: How to Reduce Your Spend on AWS
AWS APAC Webinar Series: How to Reduce Your Spend on AWS
Serverless in the Azure World by Kasun Kodagoda
Serverless in the Azure WorldServerless in the Azure World
Serverless in the Azure World
Kasun Kodagoda175 views
Google Cloud Platform as a Backend Solution for your Product by Sergey Smetanin
Google Cloud Platform as a Backend Solution for your ProductGoogle Cloud Platform as a Backend Solution for your Product
Google Cloud Platform as a Backend Solution for your Product
Sergey Smetanin1.3K views
Going Serverless with Azure Functions #1 - Introduction to Azure Functions by Kasun Kodagoda
Going Serverless with Azure Functions #1 - Introduction to Azure FunctionsGoing Serverless with Azure Functions #1 - Introduction to Azure Functions
Going Serverless with Azure Functions #1 - Introduction to Azure Functions
Kasun Kodagoda172 views
Serverlessusecase workshop feb3_v2 by kartraj
Serverlessusecase workshop feb3_v2Serverlessusecase workshop feb3_v2
Serverlessusecase workshop feb3_v2
kartraj152 views

More from Rick van den Bosch

Configuration in azure done right by
Configuration in azure done rightConfiguration in azure done right
Configuration in azure done rightRick van den Bosch
353 views28 slides
Getting started with Azure Cognitive services by
Getting started with Azure Cognitive servicesGetting started with Azure Cognitive services
Getting started with Azure Cognitive servicesRick van den Bosch
99 views29 slides
From .NET Core 3, all the rest will be legacy by
From .NET Core 3, all the rest will be legacyFrom .NET Core 3, all the rest will be legacy
From .NET Core 3, all the rest will be legacyRick van den Bosch
291 views54 slides
Getting sh*t done with Azure Functions (on AKS!) by
Getting sh*t done with Azure Functions (on AKS!)Getting sh*t done with Azure Functions (on AKS!)
Getting sh*t done with Azure Functions (on AKS!)Rick van den Bosch
776 views43 slides
Securing an Azure Function REST API with Azure Active Directory by
Securing an Azure Function REST API with Azure Active DirectorySecuring an Azure Function REST API with Azure Active Directory
Securing an Azure Function REST API with Azure Active DirectoryRick van den Bosch
259 views29 slides
Azure Lowlands: An intro to Azure Data Lake by
Azure Lowlands: An intro to Azure Data LakeAzure Lowlands: An intro to Azure Data Lake
Azure Lowlands: An intro to Azure Data LakeRick van den Bosch
1.6K views52 slides

More from Rick van den Bosch(12)

From .NET Core 3, all the rest will be legacy by Rick van den Bosch
From .NET Core 3, all the rest will be legacyFrom .NET Core 3, all the rest will be legacy
From .NET Core 3, all the rest will be legacy
Rick van den Bosch291 views
Getting sh*t done with Azure Functions (on AKS!) by Rick van den Bosch
Getting sh*t done with Azure Functions (on AKS!)Getting sh*t done with Azure Functions (on AKS!)
Getting sh*t done with Azure Functions (on AKS!)
Rick van den Bosch776 views
Securing an Azure Function REST API with Azure Active Directory by Rick van den Bosch
Securing an Azure Function REST API with Azure Active DirectorySecuring an Azure Function REST API with Azure Active Directory
Securing an Azure Function REST API with Azure Active Directory
Rick van den Bosch259 views
Azure Lowlands: An intro to Azure Data Lake by Rick van den Bosch
Azure Lowlands: An intro to Azure Data LakeAzure Lowlands: An intro to Azure Data Lake
Azure Lowlands: An intro to Azure Data Lake
Rick van den Bosch1.6K views
TechDays 2017 - Going Serverless (2/2): Hands-on with Azure Event Grid by Rick van den Bosch
TechDays 2017 - Going Serverless (2/2): Hands-on with Azure Event GridTechDays 2017 - Going Serverless (2/2): Hands-on with Azure Event Grid
TechDays 2017 - Going Serverless (2/2): Hands-on with Azure Event Grid
Rick van den Bosch379 views
TechDays 2016 - Case Study: Azure + IOT + LoRa = ”Leven is Water” by Rick van den Bosch
TechDays 2016 - Case Study: Azure + IOT + LoRa = ”Leven is Water”TechDays 2016 - Case Study: Azure + IOT + LoRa = ”Leven is Water”
TechDays 2016 - Case Study: Azure + IOT + LoRa = ”Leven is Water”
Rick van den Bosch996 views
Take control of your deployments with Release Management by Rick van den Bosch
Take control of your deployments with Release ManagementTake control of your deployments with Release Management
Take control of your deployments with Release Management
Rick van den Bosch967 views

Recently uploaded

Automated Testing of Microsoft Power BI Reports by
Automated Testing of Microsoft Power BI ReportsAutomated Testing of Microsoft Power BI Reports
Automated Testing of Microsoft Power BI ReportsRTTS
11 views20 slides
Transport Management System - Shipment & Container Tracking by
Transport Management System - Shipment & Container TrackingTransport Management System - Shipment & Container Tracking
Transport Management System - Shipment & Container TrackingFreightoscope
6 views3 slides
aATP - New Correlation Confirmation Feature.pptx by
aATP - New Correlation Confirmation Feature.pptxaATP - New Correlation Confirmation Feature.pptx
aATP - New Correlation Confirmation Feature.pptxEsatEsenek1
222 views6 slides
Page Object Model by
Page Object ModelPage Object Model
Page Object Modelartembondar5
7 views5 slides
FOSSLight Community Day 2023-11-30 by
FOSSLight Community Day 2023-11-30FOSSLight Community Day 2023-11-30
FOSSLight Community Day 2023-11-30Shane Coughlan
8 views18 slides
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P... by
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...NimaTorabi2
17 views17 slides

Recently uploaded(20)

Automated Testing of Microsoft Power BI Reports by RTTS
Automated Testing of Microsoft Power BI ReportsAutomated Testing of Microsoft Power BI Reports
Automated Testing of Microsoft Power BI Reports
RTTS11 views
Transport Management System - Shipment & Container Tracking by Freightoscope
Transport Management System - Shipment & Container TrackingTransport Management System - Shipment & Container Tracking
Transport Management System - Shipment & Container Tracking
Freightoscope 6 views
aATP - New Correlation Confirmation Feature.pptx by EsatEsenek1
aATP - New Correlation Confirmation Feature.pptxaATP - New Correlation Confirmation Feature.pptx
aATP - New Correlation Confirmation Feature.pptx
EsatEsenek1222 views
FOSSLight Community Day 2023-11-30 by Shane Coughlan
FOSSLight Community Day 2023-11-30FOSSLight Community Day 2023-11-30
FOSSLight Community Day 2023-11-30
Shane Coughlan8 views
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P... by NimaTorabi2
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
NimaTorabi217 views
Bootstrapping vs Venture Capital.pptx by Zeljko Svedic
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptx
Zeljko Svedic16 views
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile... by Stefan Wolpers
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...
How To Make Your Plans Suck Less — Maarten Dalmijn at the 57th Hands-on Agile...
Stefan Wolpers44 views
Top-5-production-devconMunich-2023-v2.pptx by Tier1 app
Top-5-production-devconMunich-2023-v2.pptxTop-5-production-devconMunich-2023-v2.pptx
Top-5-production-devconMunich-2023-v2.pptx
Tier1 app9 views
predicting-m3-devopsconMunich-2023-v2.pptx by Tier1 app
predicting-m3-devopsconMunich-2023-v2.pptxpredicting-m3-devopsconMunich-2023-v2.pptx
predicting-m3-devopsconMunich-2023-v2.pptx
Tier1 app14 views
Top-5-production-devconMunich-2023.pptx by Tier1 app
Top-5-production-devconMunich-2023.pptxTop-5-production-devconMunich-2023.pptx
Top-5-production-devconMunich-2023.pptx
Tier1 app10 views
How to build dyanmic dashboards and ensure they always work by Wiiisdom
How to build dyanmic dashboards and ensure they always workHow to build dyanmic dashboards and ensure they always work
How to build dyanmic dashboards and ensure they always work
Wiiisdom16 views
JioEngage_Presentation.pptx by admin125455
JioEngage_Presentation.pptxJioEngage_Presentation.pptx
JioEngage_Presentation.pptx
admin1254559 views
tecnologia18.docx by nosi6702
tecnologia18.docxtecnologia18.docx
tecnologia18.docx
nosi67026 views

SAFwAD @ Intelligent Cloud Conference

  • 1. Session Rick van den Bosch Securing an Azure Function REST API with Azure Active Directory #SAFwAD Session
  • 2. Rick van den Bosch @rickvdbosch rickvandenbosch.net rickvdbosch@outlook.com
  • 3. Azure Active Directory Azure Functions Static website hosting ADAL & MSAL Putting things together Agenda
  • 5. “Azure Active Directory (Azure AD) is Microsoft’s cloud-based identity and access management service. Azure AD helps your employees sign in and access resources” Azure Active Directory
  • 6. • Seamless, highly secure access • Comprehensive identity protection • Efficient management and compliance at scale • Customer and partner identities • Identity platform for developers • Identity for IaaS (infrastructure as a service) Azure Active Directory
  • 8. IT admins App developers Subscribers of - Microsoft 365 - Office 365 - Azure - Dynamics CRM online Who uses Azure AD?
  • 9. Free FREE! Basic € 0,844 kr 6,294 user / month * Premium P1 € 5,06 kr 37,761 user / month * Premium P2 € 7,59 kr 56,641 user / month * “Pay as you go” feature license. * Annual commitment Pricing tiers
  • 10. “Azure Active Directory (Azure AD) B2C is an identity management service that enables you to customize and control how customers sign up, sign in, and manage their profiles when using your applications. This includes applications developed for iOS, Android, and .NET, among others.” Azure AD B2C
  • 11. Azure AD B2C - Pricing
  • 13. “Accelerate your development with an event-driven, serverless compute experience. Scale on demand and pay only for the resources you consume.” Azure Functions
  • 14. • Take advantage of serverless compute with Functions • Manage your apps instead of infrastructure • Optimize for business logic • Develop your way Azure Functions
  • 15. Web application backends Mobile application backends Real-time file processing Real-time stream processing Automation of scheduled tasks Extending SaaS applications What you can do with Functions
  • 16. Two major versions: 1.x and 2.x Current version: 2.x Both supported for production Runtimes
  • 17. Supported languages Language 1.x 2.x C# GA (.NET Framework 4.7) GA (.NET Core 2) JavaScript GA (Node 6) GA (Node 8 & 10) F# GA (.NET Framework 4.7) GA (.NET Core 2) Java N/A Preview (Java 8) Python Experimental Preview (Python 3.6) TypeScript Experimental GA (Supported through transpiling to JavaScript) PHP Experimental N/A Batch (.cmd, .bat) Experimental N/A Bash Experimental N/A PowerShell Experimental N/A
  • 18. App Service Plan Run your functions just like your web, mobile, and API apps. When you are already using App Service for your other applications, you can run your functions on the same plan at no additional cost. Consumption plan When your function runs, Azure provides all of the necessary computational resources. You don't have to worry about resource management, and you only pay for the time that your code runs. Running Azure Functions
  • 20. Scaling can vary on a number of factors Might scale differently based on the trigger and language selected • A single function app only scales up to a maximum of 200 instances. • A single instance may process more than one message or request at a time. • HttpTriggered only be allocated at most once every 1 second. • New instances will only be allocated at most once every 30 seconds. Scaling behavior
  • 21. Long running • Keep the runtime short (default < 5m; max. 10m) Stateless • Don’t use state in the host • Idempotent Cold start • Fast start up times • Keep them small Control • ‘They’ control scaling • ‘They’ control when your host is alive • You control the code! Best practices
  • 23. • Billed based on per-second resource consumption and executions • Execution Time: € 0.000014/GB-s kr 0.000101/GB-s • Total executions: € 0.169 per million executions kr 1.259 per million executions • Monthly free grant: 1 million executions 400.000 GB-s Calculation resource consumption: avg. mem. Size in GB x execution time in ms. Mem rounded to nearest 128 MB, max 1.536 MB. Execution time rounded up to nearest 1 ms. Minimum: 100 ms & 128 mb Pricing – Consumption plan
  • 24. Functions REST API Table Storage One weekend, 7 stages Approximately 80.000 API requests 98.6% had a response time of < 250 ms 96% had a response time of < 30 ms Total costs: € 3,14 Reference case - Cultural festival
  • 25. Consumption plan++ • Enhanced performance • VNET Access Billed per second, based on vCPU-s and GB-s Premium plan (preview)
  • 27. Available on General-Purpose V2 Special container: web$ Files in this container are: • served through anonymous access requests • only available through object read operations • case-sensitive Provided at no additional cost Static website hosting
  • 29. Enables application developers to authenticate users to - Cloud Active Directory - On-premises Active Directory • Configurable token cache that stores access tokens and refresh tokens • Automatic token refresh when an access token expires and a refresh token is available • Support for asynchronous method calls Active Directory Authentication Library (ADAL)
  • 30. Enables Single Page Applications to authenticate users with - Microsoft Azure Active Directory accounts - Microsoft accounts - Accounts in social identity providers like Facebook, Google, LinkedIn etc. Interacts with - Microsoft Azure Active Directory - Microsoft Azure AD B2C - Microsoft accounts Microsoft Authentication Library (MSAL) Preview for JS
  • 33. Angular 4/5/6/7 ADAL Wrapper Can be used to authenticate Angular applications against Azure Active Directory v1 endpoint. Adal-angular4
  • 34. Wrapper of the core MSAL.js library Suitable for use in a production environment The same production level support as current libraries Changes may impact your application When GA: update within six months @azure/msal-angular
  • 38. Serverless abstracts away the compute Triggers & Bindings abstract away the services you interact with Dual abstraction
  • 39. Example: Blob Trigger on a consumption plan Up to 10-minute delay processing new blobs Solution: Switch to App Service plan with Always On enabled. Use Event Grid trigger with your Blob storage account. Triggers
  • 40. public static async Task Run( [BlobTrigger("upload/{name}", Connection = "scs")]Stream addedBlob, string name, ILogger log) { // Setting up my BlobStorageRepository (it's a wrapper) var connectionString = Environment.GetEnvironmentVariable("scs", EnvironmentVariableTarget.Process); var blobStorageRepository = new BlobStorageRepository(connectionString); await blobStorageRepository.AddFileAsync("copied", name, addedBlob); } Bindings 1/3
  • 41. Binding 2/3 public static async Task Run( [BlobTrigger("upload/{name}", Connection = "scs")]Stream addedBlob, [Blob("copied/{name}", FileAccess.Write, Connection = "scs")]Stream stream, string name, ILogger log) { await addedBlob.CopyToAsync(stream); }
  • 42. Binding 3/3 public static async Task RunAsync( [BlobTrigger("to-process/{name}", Connection = "scs")]Stream addedBlob, [ServiceBus("process", Connection = "sbcss", EntityType = EntityType.Queue)] ICollector queueCollector, string name, ILogger log) { using (var reader = new StreamReader(addedBlob)) { var words = (await reader.ReadToEndAsync()).Split(' '); Parallel.ForEach(words.Distinct(), (word) => { queueCollector.Add(word); }); } }
  • 43. Build a Serverless web app in Azure About Microsoft identity platform adal-angular4 @azure/msal-angular rickvdbos.ch/safwad Resources

Editor's Notes

  1. As an IT admin, you can use Azure AD to control access to your apps and your app resources, based on your business requirements. As an app developer, Azure AD gives you a standards-based approach for adding single sign-on (SSO) to your app, allowing it to work with a user's pre-existing credentials. As a subscriber, you're already using Azure AD.
  2. Image 1: Mobile application backends Image 2: Automation of scheduled tasks
  3. V2 The current version where new feature work and improvements are being made
  4. monitors the rate of events and determines whether to scale out or scale in Heuristics for each trigger type For example, when you're using an Azure Queue storage trigger, it scales based on the queue length and the age of the oldest queue message.
  5. Second bullet: there isn't a set limit on number of concurrent executions.
  6. The minimum execution time and memory for a single function execution is 100 ms and 128 mb respectively.
  7. When using rxjs 6, Install rxjs-compat !!!