0
我對PowerShell根本沒有太多經驗 - 我想要做的就是使用我的Azure自動化服務設置一個將自動重新啓動的Runbook凌晨1點,每天晚上我的一個Azure網絡應用程序。Azure Automation - Runbook每天自動重新啓動一個Web應用程序
是否可以使用Powershell/Azure Automation實現此目標?
我對PowerShell根本沒有太多經驗 - 我想要做的就是使用我的Azure自動化服務設置一個將自動重新啓動的Runbook凌晨1點,每天晚上我的一個Azure網絡應用程序。Azure Automation - Runbook每天自動重新啓動一個Web應用程序
是否可以使用Powershell/Azure Automation實現此目標?
這是完全可能的,你需要創建一個Azure的自動化賬號,創建一個運行手冊綁在日程安排和使用這樣的:
$connectionName = "AzureRunAsConnection" # this is the default connection created when you provision the Automation account,
# you might need to change this to your own connection name
$servicePrincipalConnection = Get-AutomationConnection -Name $connectionName
$null = Add-AzureRmAccount `
-ServicePrincipal `
-TenantId $servicePrincipalConnection.TenantId `
-ApplicationId $servicePrincipalConnection.ApplicationId `
-CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint
$null = Select-AzureRmSubscription -SubscriptionId 'SUB_GUID' ` # Needed if you have more than 1 subscription
Restart-AzureRmWebApp -ResourceGroupName xxx -Name WebAppName