Skip to content

Commit

Permalink
docs: Azure Functions Updates (#7765)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbarlow12 committed May 26, 2020
1 parent 9611137 commit af3fbf0
Show file tree
Hide file tree
Showing 20 changed files with 220 additions and 165 deletions.
4 changes: 2 additions & 2 deletions docs/providers/azure/cli-reference/deploy-list.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!--
title: Serverless Framework Commands - AWS Lambda - Deploy List
title: Serverless Framework Commands - Azure Functions - Deploy List
menuText: deploy list
menuOrder: 3
description: List your previous CloudFormation deployments
description: List your previous ARM deployments
layout: Doc
-->

Expand Down
12 changes: 12 additions & 0 deletions docs/providers/azure/cli-reference/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ The `serverless deploy` command deploys your infrastructure and app code via the
serverless deploy
```

The `sls deploy apim` command will deploy API management as configured within `serverless.yml`. If you have it configured, it will automatically deploy as a lifecycle event of `sls deploy`. However, if you make changes to your configuration or just want to deploy APIM, this will do the job

## Options

- `--resourceGroup` or `-g` - Specify the resource group name
- `--stage` or `-s` - Specify stage name
- `--region` or `-r` - Specify region name
- `--subscriptionId` or `-i` - Specify subscription ID
- `--config` or `-c` Name of your configuration file, if other than `serverless.yml|.yaml|.js|.json`.
- `--noDeploy` or `-n` Skips the deployment steps and leaves artifacts in the `.serverless` directory
- `--verbose` or `-v` Shows all stack events during deployment, and display any Stack Output.
Expand All @@ -38,9 +44,15 @@ After the `serverless deploy` command runs, all created deployment artifacts are
serverless deploy
```

```bash
# Deploy APIM
sls deploy apim
```

This is the simplest deployment usage possible. With this command, Serverless will deploy your service to the defined Azure platform endpoints.

## Provided lifecycle events

- `deploy:deploy`
- `deploy:list:list`
- `deploy:apim:apim`
17 changes: 17 additions & 0 deletions docs/providers/azure/cli-reference/invoke.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,38 @@ serverless invoke --function functionName

## Options

- `--resourceGroup` or `-g` - Specify the resource group name
- `--stage` or `-s` - Specify stage name
- `--region` or `-r` - Specify region name
- `--subscriptionId` or `-i` - Specify subscription ID
- `--config` or `-c` Name of your configuration file, if other than `serverless.yml|.yaml|.js|.json`.
- `--function` or `-f` The name of the function in your service that you want to invoke. **Required**.
- `--path` or `-p` The path to a json file with input data to be passed to the invoked function. This path is relative to the root directory of the service.
- `--data` or `-d` Stringified JSON data to be used as input to the function

You can also run `invoke local` to invoke a locally running function app or `invoke apim` to invoke a function via the configured APIM endpoint.

## Provided lifecycle events

- `invoke:invoke`

## Examples

```bash
# Invoke function directly
serverless invoke --function functionName
```

```bash
# Invoke function running locally
$ serverless invoke local --function functionName
```

```bash
# Invoke function via configured APIM endpoint
$ serverless invoke apim --function functionName
```

This example will invoke your deployed function on the configured platform endpoint. This will output the result of the invocation in your terminal.

#### Function invocation with data
Expand Down
14 changes: 1 addition & 13 deletions docs/providers/azure/cli-reference/logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,4 @@ Lets you watch the logs of a specific function.
serverless logs -f hello
```

## Options

- `--function` or `-f` The function you want to fetch the logs for. **Required**

## Examples

### Azure Functions

```bash
serverless logs -f hello
```

This will stream all future logs for a given Function.
**NOT CURRENTLY SUPPORTED**
8 changes: 8 additions & 0 deletions docs/providers/azure/cli-reference/remove.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ current working directory, from the provider.
serverless remove
```

## Options

- `--resourceGroup` or `-g` - Specify the resource group name
- `--stage` or `-s` - Specify stage name
- `--region` or `-r` - Specify region name
- `--subscriptionId` or `-i` - Specify subscription ID
- `--force` - Bypass delete check

## Provided lifecycle events

- `remove:remove`
Expand Down
4 changes: 4 additions & 0 deletions docs/providers/azure/cli-reference/rollback.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ serverless rollback --timestamp timestamp

## Options

- `--resourceGroup` or `-g` - Specify the resource group name
- `--stage` or `-s` - Specify stage name
- `--region` or `-r` - Specify region name
- `--subscriptionId` or `-i` - Specify subscription ID
- `--timestamp` or `-t` The deployment you want to rollback to.
- `--verbose` or `-v` Shows any Stack Output.

Expand Down
7 changes: 3 additions & 4 deletions docs/providers/azure/events/blobstorage.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ functions:
handler: handler.hello
events:
- blob:
x-azure-settings:
name: item #<string>, default - "myBlob", specifies which name is available on `context.bindings`
path: hello/{name}
connection: AzureWebJobsStorage #<string>, default - "AzureWebJobsStorage", App Setting/environment variable which contains Storage Account Connection String
name: item #<string>, default - "myBlob", specifies which name is available on `context.bindings`
path: hello/{name}
connection: AzureWebJobsStorage #<string>, default - "AzureWebJobsStorage", App Setting/environment variable which contains Storage Account Connection String
```

```javascript
Expand Down
20 changes: 9 additions & 11 deletions docs/providers/azure/events/cosmosdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,16 @@ functions:
handler: src/handlers/cosmos.write
events:
- http: true
x-azure-settings:
methods:
- POST
authLevel: anonymous
methods:
- POST
authLevel: anonymous
- cosmosDB:
x-azure-settings:
direction: out
name: record # name of input parameter in function signature
databaseName: sampleDB
collectionName: sampleCollection
connectionStringSetting: COSMOS_DB_CONNECTION # name of appsetting with the connection string
createIfNotExists: true # A boolean value to indicate whether the collection is created when it doesn't exist.
direction: out
name: record # name of input parameter in function signature
databaseName: sampleDB
collectionName: sampleCollection
connectionStringSetting: COSMOS_DB_CONNECTION # name of appsetting with the connection string
createIfNotExists: true # A boolean value to indicate whether the collection is created when it doesn't exist.
```

## Sample post data
Expand Down
9 changes: 4 additions & 5 deletions docs/providers/azure/events/eventhubs.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ functions:
handler: handler.hello
events:
- eventHub:
x-azure-settings:
name: item #<string>, default - "myEventHubMessage", specifies which name is available on `context.bindings`
path: hello #<string>, specifies the Name of the Event Hub
consumerGroup: $Default #<string>, default - "$Default", specifies the consumerGroup to listen with
connection: EventHubsConnection #<string>, App Setting/environment variable which contains Event Hubs Namespace Connection String
name: item #<string>, default - "myEventHubMessage", specifies which name is available on `context.bindings`
path: hello #<string>, specifies the Name of the Event Hub
consumerGroup: $Default #<string>, default - "$Default", specifies the consumerGroup to listen with
connection: EventHubsConnection #<string>, App Setting/environment variable which contains Event Hubs Namespace Connection String
```

```javascript
Expand Down
11 changes: 5 additions & 6 deletions docs/providers/azure/events/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ functions:
handler: handler.hello
events:
- http: true
x-azure-settings:
name: req #<string>, default - "req", specifies which name is available on `context.bindings`
methods: #<array> [GET, POST, PUT, DELETE], default - all
- get
route: example/hello #<string>, default - <function name>
authLevel: anonymous #<enum - anonymous|function (default)|admin>
name: req #<string>, default - "req", specifies which name is available on `context.bindings`
methods: #<array> [GET, POST, PUT, DELETE], default - all
- get
route: example/hello #<string>, default - <function name>
authLevel: anonymous #<enum - anonymous|function (default)|admin>
```

URL paths for the serverless functions are prefixed with "api" by default, e.g.
Expand Down
8 changes: 2 additions & 6 deletions docs/providers/azure/events/other.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ layout: Doc

## Other Bindings

The Azure Functions plugin also supports additional input and output bindings.
These work by setting the direction explicitly. The properties go under the
`x-azure-settings` property and match the same properties expected in the
`function.json`, with the exception of "type" which is the first property's key.
The Azure Functions plugin also supports additional input and output bindings. These work by setting the direction explicitly. The properties go under the name of the trigger and match the same properties expected in the `function.json`, with the exception of "type" which is the first property's key.

You can learn about all the bindings Azure has to offer here on the
[official documentation](https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings).
You can learn about all the bindings Azure has to offer here on the [official documentation](https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings).
5 changes: 2 additions & 3 deletions docs/providers/azure/events/queuestorage.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ functions:
handler: handler.hello
events:
- queue: hello
x-azure-settings:
name: item #<string>, default - "myQueueItem", specifies which name is available on `context.bindings`
connection: AzureWebJobsStorage #<string>, default - "AzureWebJobsStorage", environment variable which contains Storage Account Connection String
name: item #<string>, default - "myQueueItem", specifies which name is available on `context.bindings`
connection: AzureWebJobsStorage #<string>, default - "AzureWebJobsStorage", environment variable which contains Storage Account Connection String
```

```javascript
Expand Down
18 changes: 8 additions & 10 deletions docs/providers/azure/events/servicebus.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ functions:
handler: handler.hello
events:
- serviceBus:
x-azure-settings:
name: item #<string>, default - "mySbMsg", specifies which name is available on `context.bindings`
queueName: hello #<string>, specifies the queue name to listen on
accessRights: manage #<enum manage|listen>, specifies the permission to use when listening on the queue (manage will create queue if not exists)
connection: ServiceBusConnection #<string>, environment variable which contains Service Bus Namespace Connection String
name: item #<string>, default - "mySbMsg", specifies which name is available on `context.bindings`
queueName: hello #<string>, specifies the queue name to listen on
accessRights: manage #<enum manage|listen>, specifies the permission to use when listening on the queue (manage will create queue if not exists)
connection: ServiceBusConnection #<string>, environment variable which contains Service Bus Namespace Connection String
```

```javascript
Expand Down Expand Up @@ -66,11 +65,10 @@ functions:
handler: handler.hello
events:
- serviceBus:
x-azure-settings:
name: item #<string>, default - "mySbMsg", specifies which name it's available on `context.bindings`
topicName: 'hello' #<string>, topic to listen on
subscriptionName: 'hello' #<string>, subscription to listen on
connection: ServiceBusConnection #<string>, environment variable which contains Service Bus Namespace Connection String
name: item #<string>, default - "mySbMsg", specifies which name it's available on `context.bindings`
topicName: 'hello' #<string>, topic to listen on
subscriptionName: 'hello' #<string>, subscription to listen on
connection: ServiceBusConnection #<string>, environment variable which contains Service Bus Namespace Connection String
```

```javascript
Expand Down
5 changes: 2 additions & 3 deletions docs/providers/azure/events/timer.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ functions:
handler: handler.hello
events:
- timer:
x-azure-settings:
name: timerObj #<string>, default - "myTimer", specifies which name is available on `context.bindings`
schedule: 0 */5 * * * * #<string>, cron expression to run on
name: timerObj #<string>, default - "myTimer", specifies which name is available on `context.bindings`
schedule: 0 */5 * * * * #<string>, cron expression to run on
```

```javascript
Expand Down
24 changes: 1 addition & 23 deletions docs/providers/azure/guide/deploying.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,7 @@ The Serverless Framework translates all syntax in `serverless.yml` to an [Azure
- The code of your Functions is then packaged into a directory and zipped.
- Resources are deployed in the following order: _ARM template, Functions_

### Deployment Approach #1 - Upload Package to Function App

> Note: Recommended for Function Apps running on Windows
Current default behavior. To set explicitly in `serverless.yml`, add this section:

```yaml
deploy:
runFromBlobUrl: false
```

### Deployment Approach #2 - Run from Package in Blob Storage

> Note: Not currently recommended for Function Apps running on Windows
To set in `serverless.yml`, add this section:

```yaml
deploy:
runFromBlobUrl: true
```

Visit the [docs](https://docs.microsoft.com/en-us/azure/azure-functions/run-functions-from-deployment-package#enabling-functions-to-run-from-a-package) for more detail on the two approaches to deployment.
For more detail on deployment, visit our [docs](https://github.com/serverless/serverless-azure-functions/blob/master/docs/DEPLOY.md)

### Rollback

Expand Down
14 changes: 5 additions & 9 deletions docs/providers/azure/guide/function-apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,18 @@ functions:
handler: hello.handler
events:
- http: true
x-azure-settings:
authLevel: anonymous
authLevel: anonymous
- http: true
x-azure-settings:
direction: out
direction: out
name: res
goodbye:
handler: goodbye.handler
events:
- http: true
x-azure-settings:
authLevel: anonymous
authLevel: anonymous
- http: true
x-azure-settings:
direction: out
name: res
direction: out
name: res
```

### hello.js and goodbye.js
Expand Down
6 changes: 2 additions & 4 deletions docs/providers/azure/guide/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ If you are using Azure Functions as a provider, all _functions_ inside the servi

## Configuration

All of the Azure Functions in your serverless service can be found in
`serverless.yml` under the `functions` property.
All of the Azure Functions in your serverless service can be found in `serverless.yml` under the `functions` property.

```yml
# serverless.yml
Expand All @@ -37,8 +36,7 @@ functions:
handler: templates/handler.hello
events:
- http: true
x-azure-settings:
authLevel: anonymous # can also be `function` or `admin`
authLevel: anonymous # can also be `function` or `admin`
```

The `handler` property points to the file (default filename: handler.js) and
Expand Down
6 changes: 2 additions & 4 deletions docs/providers/azure/guide/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,14 @@ functions: # Your "Functions"
usersCreate:
events: # The "Events" that trigger this function
- http: true
x-azure-settings:
name: req
name: req
methods:
- post
route: /users/create
usersDelete:
events:
- http: true
x-azure-settings:
name: req
name: req
methods:
- delete
route: /users/delete
Expand Down

0 comments on commit af3fbf0

Please sign in to comment.