Adding a virtual directory to an Azure site using Powershell

Is there a way to add a virtual directory to an Azure Website using Powershell?

Background: we have one solution with the ASP.Net MVC application and Web.API projects. We publish the application to the root of the azure site, and Web.API to the virtual directory below it.

This works well while you add the virtual directory manually to the Azure portal. (For some reason, project settings do not apply to website settings).

Since we are trying to automate the deployment process, we would like to add the missing virtual directory using the Powershell script.

+5
source share
2 answers

Looks like a valid (if somewhat complicated) answer here:

In short: you have to use the AzureResourceManager and work with the Microsoft.web / sites / config object to get and install virtual directories.

https://social.msdn.microsoft.com/Forums/azure/en-US/990f41fd-f8b6-43a0-b942-cef0308120b2/add-virtual-application-and-directory-to-an-azure-website-using- powershell? forum = windowsazurewebsitespreview

+4
source

I just tried to do this recently and found a simpler solution here :

$website = Get-AzureRmWebApp -Name "myWebApp" -ResourceGroupName "myResourceGroup" $VDApp = New-Object Microsoft.Azure.Management.WebSites.Models.VirtualApplication $VDApp.VirtualPath = "/TEST" $VDApp.PhysicalPath = "site\\TEST" $VDApp.PreloadEnabled ="YES" $website.siteconfig.VirtualApplications.Add($VDApp) $website | Set-azureRmWebApp 
+2
source

Source: https://habr.com/ru/post/1208469/


All Articles