/etc/apt/sources.list.d/dotnetdev.list
file for one of the appropriate Linux version strings listed below:Linux distribution | Version |
---|---|
Debian 10 | buster |
Debian 9 | stretch |
Ubuntu 20.04 | focal |
Ubuntu 19.04 | disco |
Ubuntu 18.10 | cosmic |
Ubuntu 18.04 | bionic |
Ubuntu 17.04 | zesty |
Ubuntu 16.04/Linux Mint 18 | xenial |
func init
supports the following options, which are version 3.x/2.x-only, unless otherwise noted:Option | Description |
---|---|
--csx | Creates .NET functions as C# script, which is the version 1.x behavior. Valid only with --worker-runtime dotnet . |
--docker | Creates a Dockerfile for a container using a base image that is based on the chosen --worker-runtime . Use this option when you plan to publish to a custom Linux container. |
--docker-only | Adds a Dockerfile to an existing project. Prompts for the worker-runtime if not specified or set in local.settings.json. Use this option when you plan to publish an existing project to a custom Linux container. |
--force | Initialize the project even when there are existing files in the project. This setting overwrites existing files with the same name. Other files in the project folder aren't affected. |
--language | Initializes a language specific project. Currently supported when --worker-runtime set to node . Options are typescript and javascript . You can also use --worker-runtime javascript or --worker-runtime typescript . |
--managed-dependencies | Installs managed dependencies. Currently, only the PowerShell worker runtime supports this functionality. |
--source-control | Controls whether a git repository is created. By default, a repository isn't created. When true , a repository is created. |
--worker-runtime | Sets the language runtime for the project. Supported values are: csharp , dotnet , javascript ,node (JavaScript), powershell , python , and typescript . For Java, use Maven.When not set, you're prompted to choose your runtime during initialization. |
--csx
parameter when you create and deploy functions.func extensions install
, you must have the .NET Core 2.x SDK installed.--force
option to update existing bindings to the latest version when installing new ones.Setting | Description |
---|---|
IsEncrypted | When this setting is set to true , all values are encrypted with a local machine key. Used with func settings commands. Default value is false . |
Values | Array of application settings and connection strings used when a project is running locally. These key-value (string-string) pairs correspond to application settings in your function app in Azure, like AzureWebJobsStorage . Many triggers and bindings have a property that refers to a connection string app setting, like Connection for the Blob storage trigger. For these properties, you need an application setting defined in the Values array. AzureWebJobsStorage is a required app setting for triggers other than HTTP. Version 2.x and higher of the Functions runtime requires the [ FUNCTIONS_WORKER_RUNTIME ] setting, which is generated for your project by Core Tools. When you have the Azure storage emulator installed locally and you set AzureWebJobsStorage to UseDevelopmentStorage=true , Core Tools uses the emulator. The emulator is useful during development, but you should test with an actual storage connection before deployment.Values must be strings and not JSON objects or arrays. Setting names can't include a colon ( : ) or a double underline (__ ). These characters are reserved by the runtime. |
Host | Settings in this section customize the Functions host process when you run projects locally. These settings are separate from the host.json settings, which also apply when you run projects in Azure. |
LocalHttpPort | Sets the default port used when running the local Functions host (func host start and func run ). The --port command-line option takes precedence over this setting. |
CORS | Defines the origins allowed for cross-origin resource sharing (CORS). Origins are supplied as a comma-separated list with no spaces. The wildcard value (*) is supported, which allows requests from any origin. |
CORSCredentials | When set to true , allows withCredentials requests. |
ConnectionStrings | A collection. Don't use this collection for the connection strings used by your function bindings. This collection is used only by frameworks that typically get connection strings from the ConnectionStrings section of a configuration file, like Entity Framework. Connection strings in this object are added to the environment with the provider type of System.Data.SqlClient. Items in this collection aren't published to Azure with other app settings. You must explicitly add these values to the Connection strings collection of your function app settings. If you're creating a SqlConnection in your function code, you should store the connection string value with your other connections in Application Settings in the portal. |
--publish-local-settings
switch when you publish to make sure these settings are added to the function app in Azure. Note that values in ConnectionStrings are never published.AzureWebJobsStorage
and the emulator isn't being used, the following error message is shown:func new
you are prompted to choose a template in the default language of your function app, then you are also prompted to choose a name for your function. In version 1.x, you are also prompted to choose the language.Argument | Description |
---|---|
--csx | (Version 2.x and later versions.) Generates the same C# script (.csx) templates used in version 1.x and in the portal. |
--language , -l | The template programming language, such as C#, F#, or JavaScript. This option is required in version 1.x. In version 2.x and later versions, do not use this option or choose a language that matches the worker runtime. |
--name , -n | The function name. |
--template , -t | Use the func templates list command to see the complete list of available templates for each supported language. |
host
command, as in the following example:func start
supports the following options:Option | Description |
---|---|
--no-build | Do no build current project before running. For dotnet projects only. Default is set to false. Not supported for version 1.x. |
--cors-credentials | Allow cross-origin authenticated requests (i.e. cookies and the Authentication header) Not supported for version 1.x. |
--cors | A comma-separated list of CORS origins, with no spaces. |
--language-worker | Arguments to configure the language worker. For example, you may enable debugging for language worker by providing debug port and other required arguments. Not supported for version 1.x. |
--cert | The path to a .pfx file that contains a private key. Only used with --useHttps . Not supported for version 1.x. |
--password | Either the password or a file that contains the password for a .pfx file. Only used with --cert . Not supported for version 1.x. |
--port , -p | The local port to listen on. Default value: 7071. |
--pause-on-error | Pause for additional input before exiting the process. Used only when launching Core Tools from an integrated development environment (IDE). |
--script-root , --prefix | Used to specify the path to the root of the function app that is to be run or deployed. This is used for compiled projects that generate project files into a subfolder. For example, when you build a C# class library project, the host.json, local.settings.json, and function.json files are generated in a root subfolder with a path like MyProject/bin/Debug/netstandard2.0 . In this case, set the prefix as --script-root MyProject/bin/Debug/netstandard2.0 . This is the root of the function app when running in Azure. |
--timeout , -t | The timeout for the Functions host to start, in seconds. Default: 20 seconds. |
--useHttps | Bind to https://localhost:{port} rather than to http://localhost:{port} . By default, this option creates a trusted certificate on your computer. |
authLevel = 'anonymous'
. For more information, see the HTTP binding article.MyHttpTrigger
quickstart function from a GET request with the name parameter passed in the query string.<trigger_input>
value contains data in a format expected by the function. The following cURL example is a POST to a QueueTriggerJS
function. In this case, the input is a string that is equivalent to the message expected to be found in the queue.func run
command (version 1.x only)func run
command is only supported in version 1.x of the tools. For more information, see the topic How to target Azure Functions runtime versions.func run <FunctionName>
and provide input data for the function. This command is similar to running a function using the Test tab in the Azure portal.func run
supports the following options:Option | Description |
---|---|
--content , -c | Inline content. |
--debug , -d | Attach a debugger to the host process before running the function. |
--timeout , -t | Time to wait (in seconds) until the local Functions host is ready. |
--file , -f | The file name to use as content. |
--no-interactive | Does not prompt for input. Useful for automation scenarios. |
publish
command:<FunctionAppName>
that doesn't exist in your subscription. To learn how to create a function app from the command prompt or terminal window using the Azure CLI, see Create a Function App for serverless execution. By default, this command uses remote build and deploys your app to run from the deployment package. To disable this recommended deployment mode, use the --nozip
option.Option | Description |
---|---|
--publish-local-settings -i | Publish settings in local.settings.json to Azure, prompting to overwrite if the setting already exists. If you are using the Microsoft Azure Storage Emulator, first change the app setting to an actual storage connection. |
--overwrite-settings -y | Suppress the prompt to overwrite app settings when --publish-local-settings -i is used. |
Option | Description |
---|---|
--publish-settings-only , -o | Only publish settings and skip the content. Default is prompt. |
--list-ignored-files | Displays a list of files that are ignored during publishing, which is based on the .funcignore file. |
--list-included-files | Displays a list of files that are published, which is based on the .funcignore file. |
--nozip | Turns the default Run-From-Package mode off. |
--build-native-deps | Skips generating .wheels folder when publishing Python function apps. |
--build , -b | Performs build action when deploying to a Linux function app. Accepts: remote and local . |
--additional-packages | List of packages to install when building native dependencies. For example: python3-dev libevent-dev . |
--force | Ignore pre-publishing verification in certain scenarios. |
--csx | Publish a C# script (.csx) project. |
--no-build | Project isn't built during publishing. For Python, pip install isn't performed. |
--dotnet-cli-params | When publishing compiled C# (.csproj) functions, the core tools calls 'dotnet build --output bin/publish'. Any parameters passed to this will be appended to the command line. |
func init
.Option | Description |
---|---|
--registry | The name of a Docker Registry the current user signed-in to. |
--platform | Hosting platform for the function app. Valid options are kubernetes |
--name | Function app name. |
--max | Optionally, sets the maximum number of function app instances to deploy to. |
--min | Optionally, sets the minimum number of function app instances to deploy to. |
--config | Sets an optional deployment configuration file. |
Setting | Suggested value | Description |
---|---|---|
New resource name | Unique app name | It's easiest to use the same name as your function app, which must be unique in your subscription. |
Location | West Europe | If possible, use the same region as your function app, or one that's close to that region. |
APPINSIGHTS_INSTRUMENTATIONKEY
, Application Insights integration is enabled for your function app running in Azure.logstream
option to start receiving streaming logs of a specific function app running in Azure, as in the following example:--browser
option, as in the following example: