Skip to content

Commit

Permalink
polished text
Browse files Browse the repository at this point in the history
  • Loading branch information
dandua98 committed Mar 18, 2019
1 parent e81e276 commit 0e45532
Showing 1 changed file with 37 additions and 35 deletions.
72 changes: 37 additions & 35 deletions docs/services/azure-functions.md
@@ -1,76 +1,78 @@
# Azure Functions

Azure Functions is a serverless compute service that enables you to run code on-demand without having to explicitly
provision or manage infrastructure. Think of it as deploying functions that run on pre-defined triggers instead of having
to write and manage a full-fledged server yourself. One of the most commonly used triggers is an HTTPTrigger which is
a function that runs whenever it receives an HTTP request (like an API endpoint). Web Template Studio allows you to deploy
a function app with multiple 'hello world' HTTPTrigger functions (maximum of 10) so you can get to writing your business
logic as soon as possible!
provision or manage infrastructure. Think of it as deploying functions that executes on pre-defined triggers instead of
having to write and manage a full-fledged server yourself. One of the most commonly used triggers is an HTTPTrigger which
is a function that runs whenever it receives an HTTP request. This is essentially the same as an API endpoint. Web
Template Studio allows you to deploy a function app with multiple 'hello world' HTTPTrigger functions (maximum of 10) so
you can get to writing your business logic as soon as possible!

## Getting started

To deploy an azure function application using Web Template Studio:
Deploying an Azure Function application using Web Template Studio:

![azure-functions-modal](../resources/azure-functions-modal.png)

- Click _Add Resource_ on Azure Functions under _services_ tab
- Click _Add Resource_ on Azure Functions under _Services_ tab

- Select a subscription and resource group from the _Create functions application_ tab that just opened. Use _Create New_
if you want to create a new subscription or resource group. _**Note:**_ New subscription would take you to Azure portal
to create a subscription.
- Select a _Subscription_ and _Resource Group_ from the _Create Functions Application_ tab that just opened. Use _Create
New_ if you want to create a new subscription or resource group. _**Note:**_ New subscription will take you to the Azure
portal to create a subscription.

- Enter a name for your function app. This name has to be globally unique since your app will be available as
`<function_app_name>.azurewebsites.net` after.
- Enter an _App Name_ for your function app. This name has to be globally unique since your app will be available as
`<function_app_name>.azurewebsites.net`.

- Select a location where your function app will be deployed. You want it to be closer to your users (or servers if it's
running as a back-end service helper)
- Select a _Location_ where your function app will be deployed. You want it to be closer to your users (or servers if it's
running as a back-end service helper).

- Select a runtime for your functions. This is basically what programming language/framework you want to write your
- Select a _Runtime_ for your functions. This is the programming language/framework you want to write your
functions in.

- Select the number of functions needed for your applications. This number can be thought of as the number of endpoints
- Select the _Number of Functions_ needed for your application. This number can be thought of as the number of endpoints
your application would need. You can rename your functions from the summary bar on the right side of the
application. These would be available as `<function_app_name>.azurewebsites.net\api\<function_name>`
application. These would be available as `<function_app_name>.azurewebsites.net\api\<function_name>`.

The _hello world_ functions deployed are pretty basic and just return _Hello, <name>_ on a query/header with the variable
'name'. For example: `<function_app_name>.azurewebsites.net\api\<function_name>?name=John+Doe` will return _Hello, John
Doe_.
The _hello world_ functions deployed are pretty basic and just return _"Hello, `<name>`"_ on a query/header with the
variable 'name'. For example: `<function_app_name>.azurewebsites.net\api\<function_name>?name=John+Doe` will return
_"Hello, John Doe"_.

## How this works

Once you hit generate, Web Template Studio creates a directory with the same name as your _function app name_ under your
Once you hit generate, Web Template Studio creates a directory with the same name as your Function's _App Name_ under your
generated project. This is compressed to a _.zip_ and deployed (using kudu zip deploy) to your newly created function
application. _**Note:**_ For advanced users, the _arm templates_ used to deploy your application are also available
under _arm-templates_ directory (under your generated project).
under the _arm-templates_ directory (inside your generated project).

## Functions app in Azure Portal

![azure-functions-portal](../resources/azure-functions-portal.png)

You can configure your functions application for advanced settings (like configuring a domain, storage accounts etc.),
delete your application etc. from your [azure portal](https://portal.azure.com). Once you login to the portal, select
functions app from the menu bar on the left side and select your application. Your individual functions are listed under
_functions_ and you can monitor them/integrate them here. Pretty much anything you need to manage about your application
can be done through the portal.
You can configure your Function Application's advanced settings (like configuring a domain, storage accounts,
delete your application etc.) from the [azure portal](https://portal.azure.com). Once you login to the portal, select
**Function Apps** from the menu bar on the left side and select your application. Your individual functions are listed
under _Functions_ and you can monitor/integrate them here. Everything you need to manage/configure about your Function
Application can be done through the portal.

## Editing your functions and deploying the changes

We strongly encourage you to install the [Azure Functions](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions) extension for VSCode by _Microsoft_ to manage your application. This enables
you to deploy your changes with a single click and test them out right away instead of manually deploying the new changes.
Once you have installed this application, here's what you need to do to deploy your changes:
We strongly encourage you to install the [Azure Functions](https://marketplace.visualstudio.com/items?
itemName=ms-azuretools.vscode-azurefunctions) extension for VSCode by **Microsoft** to manage your application. This
enables you to deploy your changes with a single click and test them out immediately instead of manually deploying the
new changes. Once you have installed this extension, here's what you need to do to deploy your changes:

![azure-functions-extension](../resources/azure-functions-extension.png)

- Open your functions application directory in a new VSCode window. Edit your function/functions file.
- Open your Function Application's directory in a new VSCode window. Edit your function file(s).

- Select Azure from the activity bar on VSCode and under the functions tab bar, click the `Deploy to function app...`
- Select Azure from the activity bar on VSCode and in the _Functions_ tab bar, click the `Deploy to function app...`
button and select your function application from the menu.

- You can also add new functions using the `Create function...` button.

- To remove a function, simply delete the corresponding files, delete all references to it and deploy again.
- To remove a function, simply delete the corresponding files and all references to it and deploy again.

### Deploying manually

If you don't want to install the extension (it is _recommended_ that you install it to make your workflow easier), follow
one of the ways mentioned in the [Azure app service zip deploy tutorial](https://docs.microsoft.com/en-us/azure/app-service/deploy-zip) to manually deploy your updated functions!
If you do not want to install the extension (it is _recommended_ that you install it to make your workflow easier), follow
one of the methods in the [Azure app service zip deploy tutorial](https://docs.microsoft.com/en-us/azure/app-service/
deploy-zip) to manually deploy your updated functions!

0 comments on commit 0e45532

Please sign in to comment.