尝试使用 Azure Functions 在 Azure Key Vault 中创建机密
Trying to create secret in Azure Key Vault using Azure Functions
每当将文本文件上传到 blob 存储时,我都试图创建一个秘密,但我在使用 az 命令时遇到以下错误:
[Warning] The Function app may be missing a module containing the 'az' command definition. If this command belongs to a module available on the PowerShell Gallery, add a reference to this module to requirements.psd1. Make sure this module is compatible with PowerShell 7.
这是我的功能
param([byte[]] $InputBlob, $TriggerMetadata)
Import-Module az
Set-AzureKeyVaultSecret -VaultName myakv -Name Mysecret -SecretValue abcde
这是我的要求.psd1
@{
Az = '7.*'
}
如果有人能给我一些建议,我将不胜感激。谢谢!
由于函数是无服务器代码,一般情况下,我们没有Key vault,我们需要通过添加一段代码来手动集成它。以下是将函数应用程序与 Kay Vault 集成的示例代码
根据 Anand-Sowmithiran 的建议,您可以使用 Set-AzKeyVaultSecret
在 Azure 函数中创建密钥保管库机密。
这是 document 用于在 Azure 中集成 Key Vault 的功能。您可以参考此以获取更多信息。
每当将文本文件上传到 blob 存储时,我都试图创建一个秘密,但我在使用 az 命令时遇到以下错误:
[Warning] The Function app may be missing a module containing the 'az' command definition. If this command belongs to a module available on the PowerShell Gallery, add a reference to this module to requirements.psd1. Make sure this module is compatible with PowerShell 7.
这是我的功能
param([byte[]] $InputBlob, $TriggerMetadata)
Import-Module az
Set-AzureKeyVaultSecret -VaultName myakv -Name Mysecret -SecretValue abcde
这是我的要求.psd1
@{
Az = '7.*'
}
如果有人能给我一些建议,我将不胜感激。谢谢!
由于函数是无服务器代码,一般情况下,我们没有Key vault,我们需要通过添加一段代码来手动集成它。以下是将函数应用程序与 Kay Vault 集成的示例代码
根据 Anand-Sowmithiran 的建议,您可以使用
Set-AzKeyVaultSecret
在 Azure 函数中创建密钥保管库机密。这是 document 用于在 Azure 中集成 Key Vault 的功能。您可以参考此以获取更多信息。