I am trying to add a virtual application to an Azure website via Powershell. Though the script runs without errors, my changes don't appear in portal.azure.com. Is there another command I need to run at the end to persist the changes?
$subscriptionId = "secret"
$websiteName = "MyWebsite"
$resourceGroupName = "MyResourceGroup"
$siteName = "Test"
Get-Module AzureRM
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionId $subscriptionId
$website = Get-AzureRmWebApp -Name $websiteName -ResourceGroupName $resourceGroupName
$VDApp = New-Object Microsoft.Azure.Management.WebSites.Models.VirtualApplication
$VDApp.VirtualPath = "/$siteName"
$VDApp.PhysicalPath = "site\$siteName"
$VDApp.PreloadEnabled ="YES"
$website.siteconfig.VirtualApplications.Add($VDApp)
$website | Set-AzureRmWebApp -ResourceGroupName $resourceGroupName