简体   繁体   English

尝试使用 Azure 函数在 Azure Key Vault 中创建秘密

[英]Trying to create secret in Azure Key Vault using Azure Functions

I am trying to create a secret whenever a text file is uploaded to blob storage but I am getting the following error using the az command:每当将文本文件上传到 blob 存储时,我都试图创建一个秘密,但使用 az 命令时出现以下错误:

[Warning] The Function app may be missing a module containing the 'az' command definition. [警告] Function 应用程序可能缺少包含“az”命令定义的模块。 If this command belongs to a module available on the PowerShell Gallery, add a reference to this module to requirements.psd1.如果此命令属于 PowerShell Gallery 上可用的模块,请将对此模块的引用添加到 requirements.psd1。 Make sure this module is compatible with PowerShell 7.确保此模块与 PowerShell 兼容 7.

This is my function这是我的 function

param([byte[]] $InputBlob, $TriggerMetadata)
Import-Module az
Set-AzureKeyVaultSecret -VaultName myakv -Name Mysecret -SecretValue abcde

And this is my requirements.psd1这是我的要求.psd1

@{
Az = '7.*'
}

Appreciate if anyone could give me some advice.如果有人能给我一些建议,我将不胜感激。 Thank you!谢谢!

  • As functions are serverless code, in general, we don't have the Key vault we need to integrate it manually by adding a piece of code.由于函数是无服务器代码,一般情况下,我们没有Key vault,我们需要通过添加一段代码来手动集成它。 Below is the sample code on integrating function app with Kay Vault以下是将 function 应用程序与 Kay Vault 集成的示例代码在此处输入图像描述

  • As suggested by Anand-Sowmithiran You can use Set-AzKeyVaultSecret for creating key vault secret in azure functions.正如Anand-Sowmithiran所建议的,您可以使用Set-AzKeyVaultSecret在 azure 函数中创建密钥保管库机密。

  • Here is the document for Integrating Key Vault in Azure functions.这是在 Azure 函数中集成 Key Vault 的文档 You can refer to this for further information.您可以参考此以获取更多信息。

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

相关问题 使用 go azure sdk 处理禁用的 azure 密钥保管库机密? - Handling a disabled azure key vault secret using go azure sdk? 使用 AAD 令牌在 Databricks 中创建 Azure Key Vault 支持的机密 scope - Create Azure Key Vault backed secret scope in Databricks with AAD Token Azure 从密钥库中检索机密 - Azure Retrieve Secret from key vault Azure 函数使用密钥库参考中的刷新秘密 - Refreshing secrets in Azure Functions using key vault reference 如何使用 powerShell 在 Azure 密钥库机密上存储 json 文件内容(密钥)? - How to store json file content(Secret Key) on Azure key-vault secrets, using powerShell? 通过参数文件将 Azure Key Vault secret 读入 ARM 模板 - Reading Azure Key Vault secret into ARM template via parameter file 在 Azure Key-vault 中哪里可以找到秘密的 scope - Where to find the scope of a secret in Azure Key-vault Azure Python SDK 检索存储帐户的 Key Vault 秘密 - Azure Python SDK retrieve Key Vault secret for storage account 在 .NET Web API 应用中集成 Azure Key Vault 使用 Secret URL - Integrate Azure Key Vault in .NET Web API application using Secret URL 如何使用 Azure 密钥保管库将 SQL 服务器的连接字符串作为秘密存储在 Azure 数据工厂中 - How to use Azure key vault for storing connection string of SQL Server as secret in Azure Data Factory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM