0
votes

I am following the tutorial from this link Deploy Asp.Net Web App To Azure VM to deploy my Asp.Net web app to an Azure VM. My source code is in VSTS. I am using the Resource Group deployment model for the Virtual Machine. I am able to run the "Azure Resource Group Deployment Task" and the "Azure File Copy" tasks successfully. The files are showing up in the temp folder. However the powershell script ConfigureWebserver.ps1 to deploy the the package does not seem to contain any information as to which web site it needs to deploy to. The Web Server has multiple web sites created. How do I modify the script to deploy to my website "mysite.com" rather than the default web site.

The powershell script

Configuration Main
 {
   Node ('localhost')
   {
     WindowsFeature WebServerRole
 {
   Name = "Web-Server"
   Ensure = "Present"
 }

 WindowsFeature WebAspNet45
 {
   Name = "Web-Asp-Net45"
   Ensure = "Present"
   Source = $Source
   DependsOn = "[WindowsFeature]WebServerRole"
 }

 #script block to download WebPI MSI from the Azure storage blob
 Script DownloadWebPIImage
 {
   GetScript = {
     @{
       Result = "WebPIInstall"
     }
   }

   TestScript = {
     Test-Path "C:\temp\wpilauncher.exe"
   }

   SetScript ={
     $source = "http://go.microsoft.com/fwlink/?LinkId=255386"
     $destination = "C:\temp\wpilauncher.exe"
     Invoke-WebRequest $source -OutFile $destination
   }
 }

 Package WebPi_Installation
     {
        Ensure = "Present"
         Name = "Microsoft Web Platform Installer 5.0"
         Path = "C:\temp\wpilauncher.exe"
         ProductId = '4D84C195-86F0-4B34-8FDE-4A17EB41306A'
         Arguments = ''
   DependsOn = @("[Script]DownloadWebPIImage")
     }

 Package WebDeploy_Installation
     {
         Ensure = "Present"
         Name = "Microsoft Web Deploy 3.6"
         Path = "$env:ProgramFiles\Microsoft\Web Platform Installer\WebPiCmd-x64.exe"
         ProductId = '{ED4CC1E5-043E-4157-8452-B5E533FE2BA1}'
   Arguments = "/install /products:ASPNET45,ASPNET_REGIIS_NET4,WDeploy  /AcceptEula"
   DependsOn = @("[Package]WebPi_Installation")
     }

 Script DeployWebPackage
 {
   DependsOn = @("[Package]WebDeploy_Installation")
   GetScript = {
     @{
       Result = ""
     }
   }

   TestScript = {
     $false
   }

   SetScript = {
     $MSDeployPath = (Get-ChildItem "HKLM:\SOFTWARE\Microsoft\IIS Extensions\MSDeploy" | Select -Last 1).GetValue("InstallPath") + "msdeploy.exe"
             cmd.exe /C $("`"{0}`" -verb:sync -source:package={1} -dest:auto,ComputerName=localhost 2> C:\temp\err.log" -f $MSDeployPath, "F:\temp\mysite.zip")
   }
 }
   }
 }
 Main
1

1 Answers

0
votes

In your SetScript for the DeployWebPackage resource, add the following argument after the -dest argument:

-setParam:'IIS Web Application Name'=mysite.com