如何从 ADO 管道中的任务 AzureFunctionApp 配置 ENV 值?
如何从 ADO 管道中的任务 AzureFunctionApp 配置 ENV 值?基本上,当我有一个与 Terraform 分开创建的 FunctionApp 时,在上传 .jar 文件的任务中,如何在推送中包含一些环境变量?
这可能吗?
我尝试了这个,但它不起作用,并且出现编译错误。
- task: AzureFunctionApp@1
inputs:
azureSubscription: ${{ parameters.serviceConnection }}
appType: 'functionApp'
appName: 'my-api-$(environment)'
package: '$(Pipeline.Workspace)/my-api/my-api-1.0.0'
runtimeStack: 'JAVA|11'
configurationStrings:
- TEST: "what"
我也尝试过这个,它可以编译并运行,但它对我来说也不起作用。部署后,环境变量不会显示在应用程序设置中。
- task: AzureFunctionApp@1
inputs:
azureSubscription: ${{ parameters.serviceConnection }}
appType: 'functionApp'
appName: 'my-api-$(environment)'
package: '$(Pipeline.Workspace)/my-api/my-api-1.0.0'
runtimeStack: 'JAVA|11'
appSettings: "-TEST what"
How can I configure ENV values from task AzureFunctionApp in ADO pipeline? Basically, when I have a FunctionApp that was created separately from Terraform, on this task that uploads the .jar file, how can I include some environment variables with the push?
Is this possible?
I tried this, but it doesn't work, and gets a compile error.
- task: AzureFunctionApp@1
inputs:
azureSubscription: ${{ parameters.serviceConnection }}
appType: 'functionApp'
appName: 'my-api-$(environment)'
package: '$(Pipeline.Workspace)/my-api/my-api-1.0.0'
runtimeStack: 'JAVA|11'
configurationStrings:
- TEST: "what"
I also tried this, which compiles and runs, and it didn't work for me either. The env variable doesn't show up in the app settings after deploy.
- task: AzureFunctionApp@1
inputs:
azureSubscription: ${{ parameters.serviceConnection }}
appType: 'functionApp'
appName: 'my-api-$(environment)'
package: '$(Pipeline.Workspace)/my-api/my-api-1.0.0'
runtimeStack: 'JAVA|11'
appSettings: "-TEST what"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据 Azure Function App 任务文档,您需要的 yaml 键是
appSettings
尝试这种方式:
应用程序设置应遵循语法 -key 值。包含空格的值应该用双引号引起来。
According to the Azure Function App Task Documentation, the yaml key that you need is
appSettings
Try this way:
Application settings should follow the syntax -key value. Values containing spaces should be enclosed in double quotes.
我为此苦苦挣扎了一段时间,所以添加了另一个我最终得到的例子。 YAML 非常脆弱,而且现有的示例文档也不是很好。注意点是 - 不要使用任何逗号来分隔值,如果值中有空格,请将其包含在 " 中,否则只需添加值而不将其括起来。
I wrestled with this for a time so adding another example of what I ended up with. YAML is so brittle and the example docs out there are not much good either. Point of note are - don't use any commas to separate the values, where there are spaces in a value, wrap it in " , otherwise just add the value without surrounding it.