Azure Functions Cli
The Azure Functions CLI provides a local development experience for creating, developing, testing, running, and debugging Azure Functions.
NOTE: This package only currently works on Windows and must be installed globally, since the underlying Functions Host is not yet cross-platform. You can upvote this GitHub issue if you're interested in running on other platforms: make the Azure Functions CLI cross platform.
Make sure you're using a Node version 6.x LTS or later, as the Yeoman dependency requires this.
npm i -g azure-functions-cli
The package sets up the following global aliases:
The CLI commands have the following basic structure:
func [context] [context] <action> [-/--options]
azure For Azure login and working with Function Apps on Azurefunction For local function settings and actionsfunctionapp For local function app settings and actionshost For local Functions host settings and actionssettings For local settings for your Functions host
func init Create a new Function App in the current folder. Initializes git repo.func run Run a function directly
Actions in the "azure" context require logging in to Azure.
func azureUsage: func azure [context] <action> [-/--options]Contexts:account For Azure account and subscriptions settings and actionsfunctionapp For Azure Function App settings and actionsstorage For Azure Storage settings and actionssubscriptions For Azure account and subscriptions settings and actionsActions:get-publish-username Get the source control publishing username for a Function App in Azureset-publish-password Set the source control publishing password for a Function App in Azurelogin Log in to an Azure account. Can also do "func azure login"logout Log out of Azure account. Can also do "func azure logout"portal Launch default browser with link to the current app in
func azure accountUsage: func azure account <action> [-/--options]Actions:set <subscriptionId> Set the active subscriptionlist List subscriptions for the logged in user
func azure functionappUsage: func azure functionapp <action> [-/--options]Actions:create Create a new Function App in Azure with default settingsenable-git-repo Enable git repository on your Azure-hosted Function Appfetch-app-settings Retrieve App Settings from your Azure-hosted Function App and store locally. Alias: fetchlist List all Function Apps in the selected Azure subscription
func azure storage list command will show storage accounts in the selected subscription. You can then set up a connection string locally with this storage account name using
func settings add-storage-account.
func azure storageUsage: func Azure Storage <action> [-/--options]Actions:list List all Storage Accounts in the selected Azure subscription
Actions that are not in the "azure" context operate on the local environment. For instance,
func settings list will show the app settings for the current function app.
func settingsUsage: func settings [context] <action> [-/--options]Actions:add Add new local app setting to appsettings.jsonadd-storage-account Add a local app setting using the value from an Azure Storage account. Requires Azure login.decrypt Decrypt the local settings filedelete Remove a local settingencrypt Encrypt the local settings filelist List local settings
func functionUsage: func function [context] <action> [-/--options]Actions:create Create a new Function from a template, using the Yeoman generatorrun Run a function directly
For consistency, the
func init command can also be invoked via
func function app init.
func functionapp init
For questions on Azure Functions or the CLI, you can ask questions here:
To file bugs, post an issue with the prefix "CLI:" in the Azure Functions Script repo on GitHub.