简体   繁体   English

Visual Studio部署队列触发器Azure功能

[英]Visual Studio Deploying Queue Trigger Azure Function

I am currently running through the tutorial written here for creating and deploying a queue triggered azure function. 我目前正在浏览此处编写的教程,该教程用于创建和部署队列触发的Azure函数。

In the "Create a function" section on step 2, it isn't clear to me what we are supposed to put for the "Connection" string. 在第2步的“创建函数”部分中,我不清楚我们应该为“ Connection”字符串放置什么。 I am assuming it is the storage account name that you want the function to use. 我假设它是您要功能使用的存储帐户名称。

The other issue I am having is when I have set up and tested the Azure Function on my local system, I go to deploy it to Azure and I am not presented with an option to select a current storage account to use. 我遇到的另一个问题是,当我在本地系统上设置并测试了Azure功能时,我打算将其部署到Azure上,并且没有选择使用当前存储帐户的选项。

在此处输入图片说明

I believe this is causing a new storage account to be created when I publish the function to azure. 我相信这会导致在我将该功能发布为Azure时创建一个新的存储帐户。 This is very frustrating because that means I have to use a storage account with an ugly GUID and also have to create a new storage queue. 这非常令人沮丧,因为这意味着我必须使用具有丑陋GUID的存储帐户,还必须创建一个新的存储队列。 Am I missing a step somewhere? 我在某处错过了一步吗?

what we are supposed to put for the "Connection" string. 我们应该为“ Connection”字符串添加的内容。

When you create a new project using the Azure Functions template, you get an empty C# project that contains the following files: host.json and local.settings.json , and you can specify connection strings to other Azure services (such as Azure storage) in local.settings.json file. 使用Azure Functions模板创建新项目时,将获得一个空C#项目,其中包含以下文件: host.jsonlocal.settings.json ,并且可以指定与其他Azure服务(例如Azure存储)的连接字符串在local.settings.json文件中。 And then you can set value of Connection option with connection string name when you create a function. 然后,在创建函数时, 可以使用连接字符串名称设置Connection选项的值。

local.settings.json local.settings.json

{
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName={your_account_name};AccountKey={your_account_key};EndpointSuffix=core.windows.net",
    "AzureWebJobsDashboard": "DefaultEndpointsProtocol=https;AccountName={your_account_name};AccountKey={your_account_key};EndpointSuffix=core.windows.net"
  }
}

Create a function and set value of Connection option with AzureWebJobsStorage 使用AzureWebJobsStorage创建函数并设置Connection选项的值

在此处输入图片说明

I am not presented with an option to select a current storage account to use. 没有为我提供选择当前要使用的存储帐户的选项。

I'm using Visual studio 2017 Version 15.3.0 preview 7.1 and Azure Functions and Web Jobs Tools Version 15.0.30923.0, It provides the option to choose Storage account . 我正在使用Visual Studio 2017版本15.3.0预览版7.1和Azure函数和Web作业工具版本15.0.30923.0,它提供了选择存储帐户的选项。 If possible, please upgrade your Visual Studio and update your Azure Functions and Web Jobs Tools. 如果可能,请升级Visual Studio并更新Azure功能和Web作业工具。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM