Azure 函数 运行 个 AZ 命令
Azure Functions Running AZ Commands
我有一个包含 az 命令的 Powershell 脚本,我 运行 来自 Azure Function
我有在 requirements.psd1 和主机中指定的模块 json 托管依赖已启用
在我的脚本中,我输入了以下命令
Get-Module -Name Az -ListAvailable
Import-Module Az
Get Module 在安装 4.8.0 时返回
然后我收到警告
[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. For more details, see https://aka.ms/functions-powershell-managed-dependency. If the module is installed but you are still getting this error, try to import the module explicitly by invoking Import-Module just before the command that produces the error: this will not fix the issue but will expose the root cause.
随后是实际命令
az storage account keys list <blah>
[Error] ERROR: The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program.Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
az cli is not available currently out the box in the functions
powershell environment. This is a feature ask and we are looking into
it.
请参考GitHub Issue#221。
目前只能使用相应的Azure PowerShell Modules
。
您可以使用 Get-AzStorageAccountKey
而不是 az storage account keys
我有一个包含 az 命令的 Powershell 脚本,我 运行 来自 Azure Function
我有在 requirements.psd1 和主机中指定的模块 json 托管依赖已启用
在我的脚本中,我输入了以下命令
Get-Module -Name Az -ListAvailable
Import-Module Az
Get Module 在安装 4.8.0 时返回
然后我收到警告
[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. For more details, see https://aka.ms/functions-powershell-managed-dependency. If the module is installed but you are still getting this error, try to import the module explicitly by invoking Import-Module just before the command that produces the error: this will not fix the issue but will expose the root cause.
随后是实际命令
az storage account keys list <blah>
[Error] ERROR: The term 'az' is not recognized as the name of a cmdlet, function, script file, or operable program.Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
az cli is not available currently out the box in the functions powershell environment. This is a feature ask and we are looking into it.
请参考GitHub Issue#221。
目前只能使用相应的Azure PowerShell Modules
。
您可以使用 Get-AzStorageAccountKey
而不是 az storage account keys