2016-01-25 36 views
0

我试图从自动化运行手册运行设置AzureRmAppServicePlan但得到运行集中-AzureRmAppServicePlan从自动化脚本(运行手册)

集-AzureRmAppServicePlan:运行登录-AzureRmAccount登录。在 行:20字符:1 + SET-AzureRmAppServicePlan -ResourceGroupName” ...... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:InvalidOperation:(:) [ SET-AzureRMAppServicePlan],PSInvalidOperationException + FullyQualifiedErrorId:InvalidOperation,Microsoft.Azure.Commands.WebApps.Cmdlets.AppServicePlans.SetAzureAppServicePlanCmdlet

需要注意的是使用自动化凭据实际运行手册认证成功 我可以运行此脚本本地Power Shell使用 Login-AzureRmAccount Add-AzureRmAccount 设置-AzureRmAppServicePlan ...

是否有可能在所有的自动化而无需交互式登录跑的? 感谢 帕维尔

回答

0

人物出来..很简单的,而不是

添加-AzureAccount - 这是在样品使用运行手册获取-AzureVMTutorial自动创建

需要使用

附加AzureRmAccount

用于Azure资源管理器cmdlet请求,如 Set-AzureRmAppServicePlan

离开的问题/答案在这里..也许仍然帮助别人

0

如果你不使用MFA,请参阅以下CMDS,替换 '你的密码', 'yourUserName', 'yourEnvironment', 'yourSubscriptionId',“yourTenantId '与你自己的信息,并把它放到你的脚本,那么你可以登录没有交互式页面。

$userPassword = ConvertTo-SecureString -String "yourPassword" -AsPlainText -Force 
$psCred = new-object -typename System.Management.Automation.PSCredential -argumentlist 'yourUserName', $userPassword 
$credential = Get-Credential -Credential $psCred 
add-azureRmAccount -EnvironmentName 'yourEnvironment' -credential $credential -subscriptionId 'yourSubscriptionId' -tenant 'yourTenantId'