Skip to content

Commit 55aa311

Browse files
committed
minor edits
1 parent b12722c commit 55aa311

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

articles/container-instances/container-instances-tutorial-azure-function-trigger.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ In this tutorial, you create an Azure function that takes an HTTP request and tr
2121
You learn how to:
2222

2323
> [!div class="checklist"]
24-
> * Use Visual Studio Code with the [Azure Functions extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions) to create a basic HTTP-triggered PowerShell function locally. Then, deploy it to a function app in Azure.
24+
> * Use Visual Studio Code with the [Azure Functions extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions) to create a basic HTTP-triggered PowerShell function.
2525
> * Enable an identity in the function app and give it permissions to create Azure resources.
26-
> * Modify and republish the PowerShell function code to automate deployment of a single-container container group.
26+
> * Modify and republish the PowerShell function to automate deployment of a single-container container group.
2727
> * Verify the HTTP-triggered deployment of the container.
2828
2929
> [!IMPORTANT]
@@ -35,7 +35,7 @@ See [Create your first PowerShell function in Azure](../azure-functions/function
3535

3636
Some steps in this article use the Azure CLI. You can use the Azure Cloud Shell or a local installation of the Azure CLI to complete these steps. If you need to install or upgrade, see [Install Azure CLI][azure-cli-install].
3737

38-
## Create a simple PowerShell function
38+
## Create a basic PowerShell function
3939

4040
Follow steps in [Create your first PowerShell function in Azure](../azure-functions/functions-create-first-function-powershell.md) to create a PowerShell function using the HTTP Trigger template. Use the default Azure function name **HttpTrigger**. As shown in the quckstart, test the function locally, and publish the project to a function app in Azure. This example is a basic HTTP-triggered function that returns a text string. In later steps in this article, you modify the function to create a container group.
4141

@@ -65,17 +65,18 @@ az functionapp identity assign \
6565
Update the PowerShell code for the **HttpTrigger** function to create a container group. In file `run.ps1` for the function, find the following code block. This code displays a name value, if one is passed as a query string in the function URL:
6666

6767
```powershell
68-
...
68+
[...]
6969
if ($name) {
7070
$status = [HttpStatusCode]::OK
7171
$body = "Hello $name"
7272
}
73-
...
73+
[...]
7474
```
7575

7676
Replace this code with the following example block. Here, if a name value is passed in the query string, it is used to name and create a container group using the [New-AzContainerGroup][new-azcontainergroup] cmdlet. Make sure to replace the resource group name *myfunctionapp* with the name of the resource group for your function app:
7777

7878
```powershell
79+
[...]
7980
if ($name) {
8081
$status = [HttpStatusCode]::OK
8182
New-AzContainerGroup -ResourceGroupName myfunctionapp -Name $name `
@@ -84,7 +85,7 @@ if ($name) {
8485
-RestartPolicy Never
8586
$body = "Started container group $name"
8687
}
87-
...
88+
[...]
8889
```
8990

9091
This example creates a container group consisting of a single container instance running the `alpine` image. The container runs a single `echo` command and then terminates. In a real-world example, you might trigger creation of one or more container groups for running a batch job.
@@ -117,7 +118,7 @@ The function URL includes a unique code and is of the form:
117118
https://myfunctionapp.azurewebsites.net/api/HttpTrigger?code=bmF/GljyfFWISqO0GngDPCtCQF4meRcBiHEoaQGeRv/Srx6dRcrk2M==
118119
```
119120

120-
### Run the function without passing a name
121+
### Run function without passing a name
121122

122123
As a first test, run the `curl` command and pass the function URL without appending a `name` query string.
123124

@@ -144,9 +145,9 @@ The function returns status code 400 and the text `Please pass a name on the que
144145
Please pass a name on the query string or in the request body.
145146
```
146147

147-
### Test trigger and pass a name of a container group
148+
### Run function and pass a name of a container group
148149

149-
Now test the trigger by appending the name of a container group (*mycontainergroup*) as a query string `&name=mycontainergroup`:
150+
Now run the `curl` command by appending the name of a container group (*mycontainergroup*) as a query string `&name=mycontainergroup`:
150151

151152
```bash
152153
curl --verbose "https://myfunctionapp.azurewebsites.net/api/HttpTrigger?code=bmF/GljyfFWISqO0GngDPCtCQF4meRcBiHEoaQGeRv/Srx6dRcrk2M==&name=mycontainergroup"
@@ -198,9 +199,9 @@ az group delete --name myfunctionapp
198199
In this tutorial, you created an Azure function that takes an HTTP request and triggers deployment of a container group. You learned how to:
199200

200201
> [!div class="checklist"]
201-
> * Use Visual Studio Code with the Azure Functions extension to create a basic HTTP-triggered PowerShell function locally. Then, deploy it to a function app in Azure.
202+
> * Use Visual Studio Code with the Azure Functions extension to create a basic HTTP-triggered PowerShell function.
202203
> * Enable an identity in the function app and give it permissions to create Azure resources.
203-
> * Modify and republish the PowerShell function code to automate deployment of a single-container container group.
204+
> * Modify the PowerShell function code to automate deployment of a single-container container group.
204205
> * Verify the HTTP-triggered deployment of the container.
205206
206207
For a detailed example to launch and monitor a containerized job, see the blog post [Event-Driven Serverless Containers with PowerShell Azure Functions and Azure Container Instances](https://dev.to/azure/event-driven-serverless-containers-with-powershell-azure-functions-and-azure-container-instances-e9b) and accompanying [code sample](https://github.com/anthonychu/functions-powershell-run-aci).

0 commit comments

Comments
 (0)