You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-functions/create-first-function-cli-csharp-ieux.md
+26-26Lines changed: 26 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ There is also a [Visual Studio Code-based version](create-first-function-vs-code
35
35
36
36
+[Azure CLI](/cli/azure/install-azure-cli) version 2.4 or later.
37
37
38
-
+[Azure PowerShell](/powershell/azure/install-az-ps) version 5.0 or later.
38
+
+The Azure [Az PowerShell module](/powershell/azure/install-az-ps) version 5.9.0 or later.
39
39
40
40
---
41
41
@@ -57,7 +57,7 @@ Verify your prerequisites, which depend on whether you are using the Azure CLI o
57
57
58
58
+**Run**`func --version` to check that the Azure Functions Core Tools are version 3.x.
59
59
60
-
+**Run**`(Get-Module -ListAvailable Az).Version` and verify version 5.0 or later.
60
+
+**Run**`(Get-Module -ListAvailable Az).Version` and verify version 5.0 or later.
61
61
62
62
+**Run**`Connect-AzAccount` to sign in to Azure and verify an active subscription.
63
63
@@ -69,7 +69,7 @@ Verify your prerequisites, which depend on whether you are using the Azure CLI o
69
69
70
70
In this section, you create a local <abbrtitle="A logical container for one or more individual functions that can be deployed and managed together.">Azure Functions project</abbr> in C#. Each function in the project responds to a specific <abbrtitle="An event that invokes the function’s code, such as an HTTP request, a queue message, or a specific time.">trigger</abbr>.
71
71
72
-
1. Run the `func init` command to create a functions project in a folder named *LocalFunctionProj* with the specified runtime:
72
+
1. Run the `func init` command to create a functions project in a folder named *LocalFunctionProj* with the specified runtime:
73
73
74
74
```csharp
75
75
funcinitLocalFunctionProj--dotnet
@@ -83,24 +83,24 @@ In this section, you create a local <abbr title="A logical container for one or
*HttpExample.cs* contains a `Run` method that receives request data in the `req` variable is an [HttpRequest](/dotnet/api/microsoft.aspnetcore.http.httprequest) that's decorated with the **HttpTriggerAttribute**, which defines the trigger behavior.
@@ -147,7 +147,7 @@ In this section, you create a local <abbr title="A logical container for one or
147
147
<br/>
148
148
149
149
---
150
-
150
+
151
151
## 5. Create supporting Azure resources for your function
152
152
153
153
Before you can deploy your function code to Azure, you need to create a <abbr title="A logical container for related Azure resources that you can manage as a unit.">resource group</abbr>, a <abbr title="An account that contains all your Azure storage data objects. The storage account provides a unique namespace for your storage data.">storage account</abbr>, and a <abbr title="The cloud resource that hosts serverless functions in Azure, which provides the underlying compute environment in which functions run.">function app</abbr> by using the following commands:
@@ -160,15 +160,15 @@ Before you can deploy your function code to Azure, you need to create a <abbr ti
160
160
```
161
161
162
162
163
-
# [Azure PowerShell](#tab/azure-powershell)
163
+
# [Azure PowerShell](#tab/azure-powershell)
164
164
```azurepowershell
165
165
Connect-AzAccount
166
166
```
167
167
168
168
169
169
---
170
170
171
-
1. Create a resource group named `AzureFunctionsQuickstart-rg` in the `westeurope` region.
171
+
1. Create a resource group named `AzureFunctionsQuickstart-rg` in the `westeurope` region.
172
172
173
173
# [Azure CLI](#tab/azure-cli)
174
174
@@ -188,7 +188,7 @@ Before you can deploy your function code to Azure, you need to create a <abbr ti
188
188
---
189
189
190
190
You can't host Linux and Windows apps in the same resource group. If you have an existing resource group named `AzureFunctionsQuickstart-rg` with a Windows function app or web app, you must use a different resource group.
191
-
191
+
192
192
1. Create a general-purpose Azure Storage account in your resource group and region:
193
193
194
194
# [Azure CLI](#tab/azure-cli)
@@ -215,24 +215,24 @@ Before you can deploy your function code to Azure, you need to create a <abbr ti
215
215
**Replace** '<APP_NAME>' with a globally unique name.
Replace `<STORAGE_NAME>` with the name of the account you used in the previous step.
234
234
235
-
Replace `<APP_NAME>` with a <abbr title="A name that must be unique across all Azure customers globally. For example, you can use a combination of your personal or organization name, application name, and a numeric identifier, as in contoso-bizapp-func-20.">unique name</abbr>. The `<APP_NAME>` is also the default DNS domain for the function app.
235
+
Replace `<APP_NAME>` with a <abbr title="A name that must be unique across all Azure customers globally. For example, you can use a combination of your personal or organization name, application name, and a numeric identifier, as in contoso-bizapp-func-20.">unique name</abbr>. The `<APP_NAME>` is also the default DNS domain for the function app.
236
236
237
237
<br/>
238
238
<details>
@@ -281,7 +281,7 @@ Functions in msdocs-azurefunctions-qs:
281
281
282
282
## 7. Invoke the function on Azure
283
283
284
-
Copy the complete **Invoke URL** shown in the output of the `publish` command into a browser address bar. **Append** the query parameter **&name=Functions**.
284
+
Copy the complete **Invoke URL** shown in the output of the `publish` command into a browser address bar. **Append** the query parameter **&name=Functions**.
285
285
286
286

@@ -41,7 +41,7 @@ Before you begin, you must have the following:
41
41
42
42
+[Azure CLI](/cli/azure/install-azure-cli) version 2.4 or later.
43
43
44
-
+[Azure PowerShell](/powershell/azure/install-az-ps) version 5.0 or later.
44
+
+The Azure [Az PowerShell module](/powershell/azure/install-az-ps) version 5.9.0 or later.
45
45
46
46
# [Isolated process](#tab/isolated-process)
47
47
@@ -55,7 +55,7 @@ Before you begin, you must have the following:
55
55
56
56
+[Azure CLI](/cli/azure/install-azure-cli) version 2.4 or later.
57
57
58
-
+[Azure PowerShell](/powershell/azure/install-az-ps) version 5.0 or later.
58
+
+The Azure [Az PowerShell module](/powershell/azure/install-az-ps) version 5.9.0 or later.
59
59
---
60
60
::: zone-end
61
61
@@ -81,7 +81,7 @@ Verify your prerequisites, which depend on whether you are using Azure CLI or Az
81
81
82
82
+ Run `dotnet --list-sdks` to check that the required versions are installed.
83
83
84
-
+ Run `(Get-Module -ListAvailable Az).Version` and verify version 5.0 or later.
84
+
+ Run `(Get-Module -ListAvailable Az).Version` and verify version 5.0 or later.
85
85
86
86
+ Run `Connect-AzAccount` to sign in to Azure and verify an active subscription.
87
87
@@ -91,9 +91,9 @@ Verify your prerequisites, which depend on whether you are using Azure CLI or Az
91
91
92
92
In Azure Functions, a function project is a container for one or more individual functions that each responds to a specific trigger. All functions in a project share the same local and hosting configurations. In this section, you create a function project that contains a single function.
93
93
94
-
1. Run the `func init` command, as follows, to create a functions project in a folder named *LocalFunctionProj* with the specified runtime:
94
+
1. Run the `func init` command, as follows, to create a functions project in a folder named *LocalFunctionProj* with the specified runtime:
95
95
96
-
# [In-process](#tab/in-process)
96
+
# [In-process](#tab/in-process)
97
97
98
98
```console
99
99
func init LocalFunctionProj --dotnet
@@ -118,7 +118,7 @@ In Azure Functions, a function project is a container for one or more individual
118
118
119
119
```console
120
120
func new --name HttpExample --template "HTTP trigger" --authlevel "anonymous"
121
-
```
121
+
```
122
122
123
123
`func new` creates a HttpExample.cs code file.
124
124
@@ -128,23 +128,23 @@ If desired, you can skip to [Run the function locally](#run-the-function-locally
128
128
129
129
#### HttpExample.cs
130
130
131
-
The function code generated from the template depends on the type of compiled C# project.
131
+
The function code generated from the template depends on the type of compiled C# project.
132
132
133
-
# [In-process](#tab/in-process)
133
+
# [In-process](#tab/in-process)
134
134
135
135
*HttpExample.cs* contains a `Run` method that receives request data in the `req` variable is an [HttpRequest](/dotnet/api/microsoft.aspnetcore.http.httprequest) that's decorated with the **HttpTriggerAttribute**, which defines the trigger behavior.
The return object is an [ActionResult](/dotnet/api/microsoft.aspnetcore.mvc.actionresult) that returns a response message as either an [OkObjectResult](/dotnet/api/microsoft.aspnetcore.mvc.okobjectresult) (200) or a [BadRequestObjectResult](/dotnet/api/microsoft.aspnetcore.mvc.badrequestobjectresult) (400).
139
+
The return object is an [ActionResult](/dotnet/api/microsoft.aspnetcore.mvc.actionresult) that returns a response message as either an [OkObjectResult](/dotnet/api/microsoft.aspnetcore.mvc.okobjectresult) (200) or a [BadRequestObjectResult](/dotnet/api/microsoft.aspnetcore.mvc.badrequestobjectresult) (400).
140
140
141
141
# [Isolated process](#tab/isolated-process)
142
142
143
-
*HttpExample.cs* contains a `Run` method that receives request data in the `req` variable is an [HttpRequestData](/dotnet/api/microsoft.azure.functions.worker.http.httprequestdata) object that's decorated with the **HttpTriggerAttribute**, which defines the trigger behavior. Because of the isolated process model, `HttpRequestData` is a representation of the actual `HttpRequest`, and not the request object itself.
143
+
*HttpExample.cs* contains a `Run` method that receives request data in the `req` variable is an [HttpRequestData](/dotnet/api/microsoft.azure.functions.worker.http.httprequestdata) object that's decorated with the **HttpTriggerAttribute**, which defines the trigger behavior. Because of the isolated process model, `HttpRequestData` is a representation of the actual `HttpRequest`, and not the request object itself.
The return object is an [HttpResponseData](/dotnet/api/microsoft.azure.functions.worker.http.httpresponsedata) object that contains the data that's handed back to the HTTP response.
147
+
The return object is an [HttpResponseData](/dotnet/api/microsoft.azure.functions.worker.http.httpresponsedata) object that contains the data that's handed back to the HTTP response.
148
148
149
149
---
150
150
@@ -158,28 +158,28 @@ To learn more, see [Azure Functions HTTP triggers and bindings](./functions-bind
158
158
func start
159
159
```
160
160
161
-
Toward the end of the output, the following lines should appear:
162
-
161
+
Toward the end of the output, the following lines should appear:
> If HttpExample doesn't appear as shown above, you likely started the host from outside the root folder of the project. In that case, use **Ctrl**+**C** to stop the host, navigate to the project's root folder, and run the previous command again.
178
178
179
179
1. Copy the URL of your `HttpExample` function from this output to a browser:
180
180
181
181
# [In-process](#tab/in-process)
182
-
182
+
183
183
To the function URL, append the query string `?name=<YOUR_NAME>`, making the full URL like `http://localhost:7071/api/HttpExample?name=Functions`. The browser should display a response message that echoes back your query string value. The terminal in which you started your project also shows log output as you make requests.
184
184
185
185
# [Isolated process](#tab/isolated-process)
@@ -199,50 +199,50 @@ To learn more, see [Azure Functions HTTP triggers and bindings](./functions-bind
The [New-AzFunctionApp](/powershell/module/az.functions/new-azfunctionapp) cmdlet creates the function app in Azure.
226
+
The [New-AzFunctionApp](/powershell/module/az.functions/new-azfunctionapp) cmdlet creates the function app in Azure.
227
227
228
228
---
229
229
230
230
::: zone pivot="programming-runtime-functions-v4"
231
231
> [!NOTE]
232
232
> This command creates a function app using the 3.x version of the Azure Functions runtime. The `func azure functionapp publish` command that you'll run later updates the app to version 4.x.
233
233
::: zone-end
234
-
235
-
In the previous example, replace `<STORAGE_NAME>` with the name of the account you used in the previous step, and replace `<APP_NAME>` with a globally unique name appropriate to you. The `<APP_NAME>` is also the default DNS domain for the function app.
236
-
234
+
235
+
In the previous example, replace `<STORAGE_NAME>` with the name of the account you used in the previous step, and replace `<APP_NAME>` with a globally unique name appropriate to you. The `<APP_NAME>` is also the default DNS domain for the function app.
236
+
237
237
This command creates a function app running in your specified language runtime under the [Azure Functions Consumption Plan](consumption-plan.md), which is free for the amount of usage you incur here. The command also provisions an associated Azure Application Insights instance in the same resource group, with which you can monitor your function app and view logs. For more information, see [Monitor Azure Functions](functions-monitoring.md). The instance incurs no costs until you activate it.
Because your function uses an HTTP trigger and supports GET requests, you invoke it by making an HTTP request to its URL. It's easiest to do this in a browser.
243
+
Because your function uses an HTTP trigger and supports GET requests, you invoke it by making an HTTP request to its URL. It's easiest to do this in a browser.
244
244
245
-
# [In-process](#tab/in-process)
245
+
# [In-process](#tab/in-process)
246
246
247
247
Copy the complete **Invoke URL** shown in the output of the publish command into a browser address bar, appending the query parameter `?name=Functions`. When you navigate to this URL, the browser should display similar output as when you ran the function locally.
248
248
@@ -258,7 +258,7 @@ Copy the complete **Invoke URL** shown in the output of the publish command into
258
258
259
259
## Next steps
260
260
261
-
# [In-process](#tab/in-process)
261
+
# [In-process](#tab/in-process)
262
262
263
263
> [!div class="nextstepaction"]
264
264
> [Connect to Azure Queue Storage](functions-add-output-binding-storage-queue-cli.md?pivots=programming-language-csharp&tabs=in-process)
0 commit comments