I have seen many links to deploy MS Petshop using SCVMM but non of them was working , so I decided to build one and share it . This is actually a working Deployment of Petshop 4 using SCVMM service template as 2 tier Application.
If you are tuned for my book , that I hope to publish by the 1st quarter of 2013 You will find in the book more complex service templates and steps toward building service template for different applications . Wish me Luck on that .
This article is a Walk through deploying MS PetShop 4 Application http://msdn.microsoft.com/en-us/library/aa479070.aspx using SCVMM service template. The petshop package “petshopservice” files needed for this deployment include the following components:
1. PetShop Web Application zip file
2. SQL Scripts to enable SQL User , Grant permission and load data
3. Script to configure MSDTC security and Firewall
4. Script to register petshop DB on SQL Server
5. 4 SQL DAC packages
6. PetShop Service template configuration file.
You can build your own service template or import the included service template which require that you provide the following information:
1. Windows 2008R2 SP1 Syspreped VHD
2. SQL 2008R2 Syspreped VHD
3. Runs as Account to Join VM to Your Domain
4. Run as Account for SQL Authentication SA Account
5. Run as Account for SQL Windows Account Authentication
6. Run As Account for SQL instance Services
7. Web deploy Application Framework (WebDeploy_x64_en-US_2.0.1070.cr)
8. SQL DAC Framework for SQL 2008R2
9. Logical Network
After importing the Service template you need to open it and Change the configuration for SQL VM tier on the Tabs OS Configuration and SQL Server to Your environment setting you need to change:
1. Domain Name in OS Configuration
2. SQL Server Configuration (SQL Admin Account, Source directory for SQL Syspreped files )
3. Check the web Tier Domain Name in OS Configuration
Below steps are for build your own service template , To successfully deploy this application you will need:
1. Windows 2008R2 VM template , please follow my recommendationon create VM template
2. SQL SysPreped installation VM template
Note: both VM should be configured with PowerShell remotesinged execution policy
Steps that will be carried out:
1. Extract the petshop package to your SCVMM Library server
2. Create SQL Profile
3. Create Application profile for SQL Petshop DAC packages
4. Create Service template
We will create a Service template using Two Tier Application pattern, because our service template is not planed to scaled-out we will use Hardcoded machine names in the service template for the SQL Server and Web Server. The SQL Machine will be named PetSQL and the web Server will be names PetWeb
1. Create SQL Profile following instruction step 7 ,8 from my previous blog post Deploying incentive Social collaboration Software using SCVMM 2012 Service template Part 1
2. Create Application Profile for Petshop SQl DAC Packages , in the library workspace right click application Profiles and select Create application profile
3. Name your Application profile PetShopDAC , the select Application configuration , in OS compatibility Select The windows 2008R2 OS , Click Add Button and add 4 SQL Server Data-Tier Application, Select the First DAC Application and Add Application Script .
4. Select the first Added SQL Server Data-tier Application and fill the information
Name | SQL Server Data-Tier MSPetShop4 |
SQL Server Data-tier Application Package | MSPetShop4.dacpac |
SQLDAC Instance name | MSPetShop4 |
Authentication Type | Windows authentication |
Deployment run as Account | SQL Admin Account |
5. Select SQL Script and Add two post install scripts the CreateDBLoginMSPetShop4.sql has order set to 1 and LoadTablesMSPetShop4.sql has order set to 2 the Scripts will enable the SQL User account mspetshop and grant it owner permission of the DB, then load data into the database.
Name | CreateDBLoginMSPetShop4.sql |
Order | 1 |
Type | Post-install |
Log file name | c:\windows\temp\DBloginPetshop4 |
SQL Authentication type | Windows authentication |
Run as Account | SQL Admin Account |
Name | LoadTablesMSPetShop4.sql |
Order | 2 |
Type | Post-install |
Log file name | c:\windows\temp\loadtables.txt |
SQL Authentication type | Windows authentication |
Run as Account | SQL Admin Account |
6. Select the Application Script and set it to pre-install, in executable file type cmd.exe in the parameter type: /q /c DTCFirewallRules.cmd, click browse to select the PetShopDTC.cr package and select an Admin Account for this installation.
7. Add another 3 SQL Data-Tier Applications using the below information.
Name | SQL Server Data-Tier MSPetShop4Services |
SQL Server Data-tier Application Package | MSPetShop4Services.dacpac |
SQLDAC Instance name | MSPetShop4Services |
Authentication Type | Windows authentication |
Deployment run as Account | SQL Admin Account |
SQL Server Scripts:
Name | CreateDBLoginMSPetShop4Services.sql |
Order | 1 |
Type | Post-install |
Log file name | c:\windows\temp\DBloginPetServices.txt |
SQL Authentication type | Windows authentication |
Run as Account | SQL Admin Account |
Name | SQL Server Data-Tier MSPetShop4Profile |
SQL Server Data-tier Application Package | MSPetShop4Profile.dacpac |
SQLDAC Instance name | MSPetShop4Profile |
Authentication Type | Windows authentication |
Deployment run as Account | SQL Admin Account |
SQL Server Scripts:
Name | CreateDBLoginMSPetShop4Profile.sql | ||
Order | 1 | ||
Type | Post-install | ||
Log file name | c:\windows\temp\dbloginProfile.txt | ||
SQL Authentication type | Windows authentication | ||
Run as Account | SQL Admin Account | ||
Name | SQL Server Data-Tier MSPetShop4Orders | ||
SQL Server Data-tier Application Package | MSPetShop4Orders.dacpac | ||
SQLDAC Instance name | MSPetShop4Orders | ||
Authentication Type | Windows authentication | ||
Deployment run as Account | SQL Admin Account | ||
SQL Server Script:
Name | CreateDBLoginMSPetShop4Orders.sql |
Order | 1 |
Type | Post-install |
Log file name | c:\windows\temp\dbloginservice.txt |
SQL Authentication type | Windows authentication |
Run as Account | SQL Admin Account |
8. Select the Post Install Script configure it as the table below
Executable program | Cmd.exe |
Parameters | /q /c RegPetShop4DB.cmd |
Script resource package | PerShopRegDB.cr |
Run as Account | Admin Account on machine |
9. Select he pre-install Script and configure it as table below
Executable program | Cmd.exe |
Parameters | /q /c InstallSqlDAC.cmd |
Script resource package | SQL2008R2_DAC_Framework_X64.cr |
Run as Account | Admin Account on machine |
10. Create a new service template using Two Tier Application Pattern
11. Drag your SQL Syspreped VM template to First Tier instance and you Windows IIS server to Second tier instance
12. Select your First Tier SQL instance and fill name and Description , Set the Preferred Deployment order 1 and preferred service order to 1
13. Check your Hardware configuration and OS configuration (set VM Name to :PETSQL) , your VM should be configured correctly for network connectivity and domain Join with prober credentials
14. In Application Configuration select the Petshop DAC Application profile created earlier.
15. Select SQL Server Configuration and Select you SQL Server Profile and click Ok.
16. Select you second tier machine and fill name and Description , Set the Preferred Deployment order 2 and preferred service order to 2
17. Check your Hardware configuration your VM should be configured correctly for network connectivity
18. Select OS configuration (set VM Name to :PETWEB) set domain Join configuration with prober credentials then select roles and add the IIS Role and .Net 3.51 feature.
19. To configure Our Web Application we will add the petshop web application package and use Script to install the web deploy Framework into the server
a. Select Application Configuration , click add button and Select web Application
b. Is OS compatibility Select the OS your using (64 windows 2008R2)
c. Type a Name for petshop web Application
d. Click Browse and select Petshop4webpkg.zip package
e. Because we already know the SQL Server machine name we can update the connection strings that will be used by Petshop web server
f. In the setting Section select the connection strings one at a time and change the SQL server Name PETSQL (or what name you chosen for your SQL Instance)
g. Select The web Application and Click Add Application Script , we will add a script to configure MS DTC Security setting and Firewall Rules
h. Select the Application Script and set it to post-install , in executable file type cmd.exe in the parameter type: /q /c DTCFirewallRules.cmd, click browse to select the PetShopDTC.cr package and select an Admin Account for this installation.
i. Select Add and select Script set its type to preinstall, in executable file type cmd.exe in the parameter type: /q /c InstallWebDeploy.cmd , click browse to select the web deploy package and select an Admin Account for this installation and click OK.
20. The Final Service template Should look like this
21. Click configure deployment , select destination Cloud or Host Group
22. If you selected Host Group for deployment you can set the IP Pool to be used for VMs and click deploy .
23. After deployment is finished open internet explorer with the address http://petweb/petshop4
Great Job !!!!
Hi Hikmat, in the PetShopService zip file you’ve provided – I can’t see the SCVMM template XML file?
their is multiple level of Zip files you need to extract them
hi hikmat i have done all the steps but i am getting the error of script deployment order for it error 22753 and error 22632 – the script command standard error matched the failure policy setting “match any string” with its result installsqldac.cmd is not recognized as an internal or external command…these two are the major error.
Hi,
The installsqldac.cmd script will install the DAC Framework client to your SQL Serer, so you need to have the setup files for the DAC Framework in the same resource folder as the script . if you already have the DAC Framework client installed at your SQL Server you don’t need this script