GithubHelp home page GithubHelp logo

azure-samples / serverless-apis Goto Github PK

View Code? Open in Web Editor NEW
135.0 32.0 38.0 887 KB

Guidance for building serverless APIs with Azure Functions and API Management.

Home Page: https://aka.ms/serverlessapis/workshop

License: MIT License

C# 57.51% JavaScript 3.68% Shell 38.80%

serverless-apis's Introduction

Workshop: Serverless APIs in Azure

This repository contains a set of entry-level exercises, which cover the basics of building and managing serverless APIs in Microsoft Azure - with Azure Functions, Azure API Management, and Azure Application Insights.

After completing the workshop, you will be able to:

  • Understand and articulate benefits of using API management and API gateway solutions in serverless architectures
  • Expose serverless services as APIs
  • Protect, accelerate, and transform APIs with runtime policies
  • Observe the API traffic and identify problems across all layers of the stack
  • Evolve your APIs with versions, without breaking client applications
  • ... and more!

Serverless APIs

The image above illustrates the overall solution that will be created during the workshop.

What are serverless APIs?

Serverless computing enables developers to build applications faster by eliminating the need for them to manage infrastructure. With serverless applications, the cloud service provider automatically provisions, scales, and manages the infrastructure required to run the code.

Microsoft Azure offers a portfolio of serverless technologies, which can be used for building APIs. In this workshop, we will implement APIs end-to-end with Azure Functions and Azure API Management, realizing the benefits of serverless solutions:

  • Automated scaling up and down, based on API traffic, to serve bursty payloads and handle explosive growth of services
  • Architectural simplicity without no infrastructure management overhead, to spend resources on innovating and solving business problems rather than managing infrastructure
  • Pay-per-consumption pricing model, to reduce the barrier of entry to the market

Repository contents

This repository contains source code of a sample serverless API implemented with Azure Functions as well as six exercises:

  1. Setting up the Azure environment
  2. Exposing Functions as APIs in API Management
  3. Packaging APIs with Products
  4. Applying API runtime policies
  5. Monitoring APIs with Application Insights
  6. Versioning APIs

The exercises require minimal knowledge of programming. Each exercise contains references to additional resources, such as documentation, blog posts, or conference session recordings.

Getting started

Get started with Exercise 1: Provisioning Azure Resources.

Related resources

serverless-apis's People

Contributors

dbarkol avatar microsoft-github-operations[bot] avatar microsoftopensource avatar mikebudzynski avatar mpapas avatar odaibert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

serverless-apis's Issues

Errors to deploy a C# function to Function App resource

Ran up against this when trying to get the workshop started for the first time via ./serverless-apim-setup.sh:

Output results will be saved to serverles-apim-setup.log file ...

  • Creating serverless-sample7728 Resource Group ...
  • Creating serverlesssample7728 Storage Account ...
  • Creating serverless-sample7728 Application Insights Service ...
  • Application Insights Instrumentation Key: "7dce2b6f-4ab7-41bb-981f-8ae1e3f8ab4e"
  • Creating serverless-sample-products7728 Function App ...
  • Creating serverless-sample-reviews7728 Function App ...
  • Creating serverless-api7728 API Management [Consuption Plan] ...
    This command group is in preview. It may be changed/removed in a future release.
  • Deploying serverless-sample-products7728 to serverless-sample-products7728 Function App ...
    Can't determine project language from files. Please use one of [--csharp, --javascript, --typescript, --java, --python, --powershell]
    You're trying to publish to a non-v2 function app from v2 tooling.
    You can pass --force to force update the app to v2, or switch to v1 or v3 tooling for publishing
  • Deploying serverless-sample-reviews7728 to serverless-sample-reviews7728 Function App ...
    You're trying to publish to a non-v2 function app from v2 tooling.
    You can pass --force to force update the app to v2, or switch to v1 or v3 tooling for publishing
  • Attaching App Insights to Aplication Management Instance ...
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 724 100 554 100 170 636 195 --:--:-- --:--:-- --:--:-- 832
    ==============================================================

Done! Check your log information on serverless-apim-setup.log.

==============================================================

Add Azure B2C authentication workflow/process for mobile apps

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Thank you for a great write up - this is probably the clearest API Management documentation I've found to date. My request below is a long reach and I won't be offended if it's out of scope of this content. If I've got these concepts mixed up, please let me know as I am new to this area.

Current workshop notes allow protection of the API via subscription key which is great for a service/developer to consume.
Existing documentation (below) on trying to add an auth layer to an API via Azure B2C is piecemeal, scattered across different versions of state of the Azure Portal interface, and very opaque as to how to troubleshoot any of the steps. There are many many many 'quick start' tutorials of setting up the API in an unprotected state but none I've been able to use successfully to get B2C set up so as to allow a user of an app to call the API.

https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-register-spa
https://docs.microsoft.com/en-us/azure/active-directory-b2c/add-web-api-application?tabs=app-reg-ga
https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-single-page-app?tabs=app-reg-ga
https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-create-user-flows

Any log messages given by the failure

Expected/desired behavior

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Revise Products exercise

Products:

  • No dev portal (mention it applies to dedicated tiers only)
  • No access control (groups) (mention it applies to dedicated tiers only)
  • Modify exercise 2 to not mention Products
  • Provision Products in exercise 3
  • Assign APIs to Products in exercise 3

Create template for exercise

Introduction + benefit to the customer (why would they want to do it? Value prop) 

Screenshot 

Precise walkthrough 

Recap of the benefit 

Next exercise โ€“ navigation to the exercise+1 

Related content (for example links to docs, external sites etc.) 

ARM Templates / automated setup

  • Create Application Insights
  • Create API Management (Consumption tier, with App Insights plugged in)
  • Create and deploy multiple Function app with APIs

Exercise 4: Add policies

  • Add rate limiting policy at the product level and test it
  • Add CORS policy on all APIs level
  • (optionally) Add transformation policies (headers, payload)

Describe main flow via Azure portal and introduce VS Code extension as an alternative flow

Exercise 5: Monitoring

  • Application insights with basic queries, Application Map, failed requests (because of throttling) etc.
  • Mention Azure Monitor and Diagnostic Logs

'ECHO: command not found' Error

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ X] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

During 'Exercise 1: Provisioning Azure Resources',
Following your instructions, I entered the command './serverless-apim-setup.sh -s ' in Cloud Shell in Azure Portal.

But, The error './serverless-apim-setup.sh: line 6: ECHO: command not found' is output.
So, After I changed all the 'ECHO' statements to 'echo' in the vim editor, the command succeeded.

Expected/desired behavior

Code commit

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Windows 10,
I did it in Cloud Shell in Azure portal.

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.