[英]The command 'Get-AzFunctionApp ' is not working in Azure Automation Runbook
I have created a Runbook
and added below cmdlet我创建了一个
Runbook
并在 cmdlet 下添加
Get-AzFunctionApp | Stop-AzFunctionApp
I get below error我得到以下错误
The term 'Get-AzFunctionApp' is not recognized as the name of a cmdlet,
术语“Get-AzFunctionApp”未被识别为 cmdlet 的名称,
I have imported all the below modules but no luck我已经导入了以下所有模块但没有运气
After adding 'Az.Functions' I get below error添加“Az.Functions”后,出现以下错误
Failed Cannot validate argument on parameter 'SubscriptionId'.
失败 无法验证参数“SubscriptionId”上的参数。 The argument is null or empty.
参数为 null 或为空。 Provide an argument that is not null or empty, and then try the command again.
提供一个不是 null 或空的参数,然后重试该命令。 (The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.)
(参数为 null 或空。提供一个非 null 或空的参数,然后重试该命令。)
The cmdlet Get-AzFunctionApp
/ Stop-AzFunctionApp
are included in this module: Az.Functions . cmdlet
Get-AzFunctionApp
/ Stop-AzFunctionApp
包含在此模块中: Az.Functions 。
Please import this module and then the functions related operation will work.请导入此模块,然后功能相关操作将起作用。
Here is an example(please note that add the -Force
parameter for Stop-AzFunctionApp
), it works as per my testing:这是一个示例(请注意为
Stop-AzFunctionApp
添加-Force
参数),它根据我的测试工作:
$Conn = Get-AutomationConnection -Name AzureRunAsConnection
Connect-AzAccount -ServicePrincipal -Tenant $Conn.TenantID -ApplicationId $Conn.ApplicationID -CertificateThumbprint $Conn.CertificateThumbprint
Get-AzFunctionApp -ResourceGroupName xxx | Stop-AzFunctionApp -Force
From the screenshot you posted, it looks like you are missing the Az.Functions module that contains both the Get-AzFunctionApp
and Stop-AzFunctionApp
cmdlets.从您发布的屏幕截图中,您似乎缺少包含
Get-AzFunctionApp
和Stop-AzFunctionApp
cmdlet 的Az.Functions模块。
To import Az.Functions
module into your Automation account, do the following:要将
Az.Functions
模块导入您的自动化帐户,请执行以下操作:
You can also import the module through the PowerShell Gallery .您也可以通过PowerShell Gallery导入模块。 Choose the Azure Automation tab and select Deploy to Azure Automation from here: Az.Functions .
从此处选择Azure 自动化选项卡和 select部署到 Azure 自动化: Az.Functions 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.