[英]How do you automate azure login with runbooks?
我想在Powershell Azure中運行腳本,當它運行時,我需要它自動連接到Azure,而無需提示特定的用戶登錄名和密碼詳細信息。 我已經設置了自動化帳戶,有人可以建議最好的方法嗎?
您需要創建一個Azure自動連接或使用變量來傳遞用戶名\\密碼組合。 之后,只需使用帶有靜默身份驗證的常規登錄即可。 使用Azure自動連接的示例
$servicePrincipalConnection = Get-AutomationConnection -Name "name goes here"
Add-AzureRmAccount -ServicePrincipal -TenantId $servicePrincipalConnection.TenantId `
-CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint `
-ApplicationId $servicePrincipalConnection.ApplicationId | Out-Null
閱讀: https : //docs.microsoft.com/zh-cn/azure/automation/automation-connections
Azure Powershell靜默身份驗證可以通過相同的方式完成,也可以僅使用Azure AD用戶:
$cred = [pscredential]::new('user',(ConvertTo-SecureString -String 'password' -AsPlainText -Force))
Connect-AzureAD -Credential $cred
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.