Running Powershell - 如何登录和选择订阅 [英] Running Powershell - How to login and select subscription

查看:58
本文介绍了Running Powershell - 如何登录和选择订阅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Azure自动化中有PowerShell脚本。它无法找到订阅。请建议什么是正确的命令。

I have PowerShell script in Azure Automation. It cannot find subscription. Please advice what is right commands.

az登录

az login

az account set --subscription "zzz"


推荐答案

您好

要运行书籍,您需要将需要首先使用ServicePrincipal创建Connection。有ascript为自动化帐户创建服务主管 

For run books to execute, you will need to create Connection first with ServicePrincipal. There is ascript to create Service Principal for Automation Account 

https://docs.microsoft.com/en-us/azure/automation/manage-runas-account

https://docs.microsoft.com/en-us/azure/automation/manage-runas-account

准备好连接后,请在运行中使用它,如下所示:

Once you have the connection ready, use it in the run books as following:

< code>

<code>


servicePrincipalConnection
=
Get-AutomationConnection - 名称AzureRunAsConnection
servicePrincipalConnection = Get-AutomationConnection -Name AzureRunAsConnection


这篇关于Running Powershell - 如何登录和选择订阅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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