Een Azure Automation-account maken of bijwerken
U hebt een Azure Automation-account nodig om het PowerShell-runbook uit te voeren. Het proces dat in deze sectie wordt beschreven, is handig, zelfs als u een bestaand Azure Automation-account hebt dat u wilt gebruiken om het PowerShell-runbook in te stellen.
U kunt het als volgt instellen:
- Open Windows PowerShell.
- Voer de volgende cmdlet uit om u aan te melden bij uw Azure-account.
Login-AzAccount
Notitie
Uw account moet inzenderrechten hebben voor het Azure-abonnement waar u het schaalprogramma wilt implementeren.
- Voer de volgende cmdlet uit om het script voor het maken van het Azure Automation-account te downloaden:
New-Item -ItemType Directory -Path "C:\Temp" -Force
Set-Location -Path "C:\Temp"
$Uri = "https://raw.githubusercontent.com/Azure/RDS-Templates/master/wvd-templates/wvd-scaling-script/CreateOrUpdateAzAutoAccount.ps1"
# Download the script
Invoke-WebRequest -Uri $Uri -OutFile ".\CreateOrUpdateAzAutoAccount.ps1"
- Voer de volgende cmdlet uit om het script uit te voeren en het Azure Automation-account te maken. U kunt waarden invullen voor de parameters of opmerkingen toevoegen om hun standaardwaarden te gebruiken.
$Params = @{
"AADTenantId" = "<Azure_Active_Directory_tenant_ID>" # Optional. If not specified, it will use the current Azure context. "SubscriptionId" = "<Azure_subscription_ID>" # Optional. If not specified, it will use the current Azure context.
"UseARMAPI" = $true
"ResourceGroupName" = "<Resource_group_name>" # Optional. Default: "AVDAutoScaleResourceGroup"
"AutomationAccountName" = "<Automation_account_name>" # Optional. Default: "AVDAutoScaleAutomationAccount"
"Location" = "<Azure_region_for_deployment>"
"WorkspaceName" = "<Log_analytics_workspace_name>" # Optional. If specified, Log Analytics will be used to configure the custom log table that the runbook PowerShell script can send logs to.
}
.\CreateOrUpdateAzAutoAccount.ps1 @Params
- De uitvoer van de cmdlet bevat een webhook-URI. Zorg ervoor dat u een record van de URI bewaart, omdat u deze gebruikt als parameter bij het instellen van het uitvoeringsschema voor de logische Azure-app.
- Als u de parameter WorkspaceName voor Log Analytics hebt opgegeven, bevat de uitvoer van de cmdlet ook de Log Analytics-werkruimte-id en de primaire sleutel. Vergeet niet dat u de URI onthoudt, omdat u deze later opnieuw moet gebruiken als parameter bij het instellen van het uitvoeringsschema voor de logische Azure-app.
- Nadat u uw Azure Automation-account hebt ingesteld, meldt u zich aan bij uw Azure-abonnement en controleert u of uw Azure Automation-account en het relevante runbook zijn weergegeven in de opgegeven resourcegroep, zoals wordt weergegeven in de volgende afbeelding:
Als u wilt controleren of uw webhook de locatie moet zijn, selecteert u de naam van uw runbook. Ga vervolgens naar de sectie Resources van uw runbook en selecteer Webhooks.