SQL托管实例 - SQL代理 - PowerShell步骤 [英] SQL managed instance - SQL Agent - PowerShell step

查看:109
本文介绍了SQL托管实例 - SQL代理 - PowerShell步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,

在我的SQL托管实例的SQL代理中,我定义了一个使用以下脚本启动RunBook的PowerShell步骤:

In the SQL Agent of my SQL managed instance, I defined a PowerShell step that launch a RunBook using the following script:

Connect-AzAccount `
    -ServicePrincipal `
    -Credential $credential `
    -Tenant $tenantId `
    -Subscription "***"

Start-AzAutomationRunbook `
    -AutomationAccountName "***" `
    -Name "ProcessASDatabase" `
    -RunOn "***" `
    -ResourceGroupName "***" `
    -Parameters @{"DatabaseName"="MyCube";"RefreshType"="Full"} `
    -Wait

但是我收到以下错误:

术语"Connect-AzAccount"无法识别为cmdlet函数的名称,脚本文件,或可操作的程序。 

But I receive the following error:
The term 'Connect-AzAccount' is not recognized as the name of a cmdlet, function, script file, or operable program. 

您知道如何在SQL代理服务器上安装Az模块吗?

Do you know how can I install the Az module on the SQL Agent server ?

推荐答案

您好Guillaume,

Hi Guillaume,

您是否尝试在没有PowerShell脚本的Connect-AzAccount部分的情况下运行解决方案?如果您在订阅中运行流程,则无需进行身份验证。

Have you attempted to run the solution without the Connect-AzAccount portion of the PowerShell script? If you are running a process within your subscription, you shouldn't need to authenticate.

使用PowerShell调用Azure自动化作业

如果您的情况有效,请告诉我们。

Please let us know if this works in your situation.

谢谢,

Mike


这篇关于SQL托管实例 - SQL代理 - PowerShell步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆