[英]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.