This blog will show you how to deploy web deployment package , SQL Service and Microsoft SQL Data-Tier Application (DAC) package using System Center Virtual Machine Manager 2012 through Creating Service Templates using the VMM 2012 Service Template Designer. The resultant service template can be used to deploy service against direct host or Private cloud through Microsoft App controller or System Center Virtual Machine Manager 2012 Console.
In my pervious blog post I have showed how to create a Microsoft SQL Data-Tier Application (DAC) Package and web deployment package for Social collaboration incentive web Application , in this post we will use these Files to deploy service in System Center Virtual Machine Manager 2012. The below step are for Creating Service Templates using the VMM 2012 Service Template Designer.
1. Prepared a syspreped VM templates Windows 20088R2SP1
- Enable inbound File Sharing Firewall Rule
- Enable remote management Firewall Rules
2. Prepared a syspreped SQL 2008 R2 VM templates Windows 20088R2 SP1 , see VMM 2012 SQL Server Profile technet blog post
- Enable inbound File Sharing Firewall Rules
- Create a inbound Rule for SQL at Port 1433 Firewall Rules
- Enable remote management Firewall Rules
3. download MS SQL DAC Framework , create a folder in your SCVMM2012 library call it SQL2008R2_DAC_Framework_X64.cr
(e.g. \VMMLib\ApplicationFrameworks\SQL2008R2_DAC_Framework_X64.cr)
Create a patch file “InstallSqlDAC.cmd” to install the DAC Framework in the same folder, The content of the patch file is:
@echo off
echo Installing SQL 2008R2 DACFramework …
start /wait %windir%\system32\msiexec.exe /qn /i DACFramework.msi /l %temp%\DACFramework.log
if errorlevel 1 (
echo “SQL 2008R2 DACFramework installation failed. See log at %%temp%%\DACFramework.log for more details.”
exit 1
goto EOF
)
echo DACFramework installed.
echo Installing SQL 2008R2 SharedManagementObjects …
start /wait %windir%\system32\msiexec.exe /qn /i SharedManagementObjects.msi /l %temp%\SharedManagementObjects.log
if errorlevel 1 (
echo “SQL 2008R2 SharedManagementObjects installation failed. See log at %%temp%%\SharedManagementObjects.log for more details.”
exit 1
goto EOF
)
echo SharedManagementObjects installed.
echo Installing SQL 2008R2 SQLSysClrTypes …
start /wait %windir%\system32\msiexec.exe /qn /i SQLSysClrTypes.msi /l %temp%\SQLSysClrTypes.log
if errorlevel 1 (
echo “SQL 2008R2 SQLSysClrTypes.msi installation failed. See log at %%temp%%\SQLSysClrTypes.log for more details.”
exit 1
goto EOF
)
echo SQLSysClrTypes installed.
echo Installing SQL 2008R2 TSqlLanguageService.msi …
start /wait %windir%\system32\msiexec.exe /qn /i TSqlLanguageService.msi /l %temp%\TSqlLanguageService.log
if errorlevel 1 (
echo “SQL 2008R2 TSqlLanguageService.msi installation failed. See log at %%temp%%\TSqlLanguageService.log for more details.”
exit 1
goto EOF
)
echo TSqlLanguageService installed.
:EOF
4. Verify that you have the latest web deploy package. if you received the error “Deploying web application VMM 2012 fail with error ApplicationFrameworkNotInstalled;2.0.1070.” check this post
5. Create a folder in your SCVMM2012 library call it “incentiveApp” Copy the incentive web deploy package and the incentive DAC package that you have created following my pervious blog post to this folder.
6. Create SQL Script file “Createandenableuserincentive.sql “ in the same folder.
The script will create the user “incentiveuser” login, set password and Bd_ownership on the application DB called “incentive” , the second part of the script is a copy of the prepare.sql script from the original package. it has the following content :
USE [master]
GO
CREATE LOGIN [incentiveuser] WITH PASSWORD=N’P@ssw0rd’, DEFAULT_DATABASE=[master], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
USE [incentive]
GO
CREATE USER [incentiveuser] FOR LOGIN [incentiveuser]
GO
USE [incentive]
GO
EXEC sp_addrolemember N’db_owner’, N’incentiveuser’
GO
——————————————-
– insert everyone group and anonymous user
—————————————–
SET IDENTITY_INSERT [dbo].[UserGroup] ON
INSERT [dbo].[UserGroup] ([ID], [Name], [Email], [DistinguishedName], [NetworkGuid], [Description], [Type], [Created], [Modified]) VALUES (-1, N’Everyone’, null, null, null, null, 0, CAST(0x00009881010D19E1 AS DateTime), CAST(0x00009AA300FFAA93 AS DateTime))
SET IDENTITY_INSERT [dbo].[UserGroup] OFF
GO
USE [incentive]
GO
SET IDENTITY_INSERT [dbo].[User] ON
INSERT [dbo].[User] ([ID], [Name], [Email], [DistinguishedName], [NetworkGuid], [NetworkUsername], [Username], [Password], [Type], [Created], [Modified], [IsAdmin], [Enabled], [LastLogin], [ContentID]) VALUES (-1, N’Anonymous’, NULL, NULL, NULL, NULL, N’anonymous’, NULL, 0, CAST(0x00009AF000EEB432 AS DateTime), CAST(0x00009AF000EEB432 AS DateTime), 0, 1, NULL, NULL)
SET IDENTITY_INSERT [dbo].[User] OFF
GO
7. In SCVMM setting , create the needed Run AS accounts for this deployment
- SQL Authentication SA Account
- SQL windows authentication SA Account
- Local Administrator Account
- Domain Account with local Administrator permission and permission to Join computer to domain
- SQL Service Account ( you can have one account for all services or create account for each service)
8. in SCVMM Library Create SQL Profile , with the following settings
Instance Name Should read: MSSQLSERVER
Instance ID ”the ID you used during SQL Sysprep installation” : SQLSYSPREPED
Installation Account: Account with Local Administrator permission
The Media source should point to the SQL installation CD
The Account under witch SQL Services will Run.
Note: you can Create a separate for each service or use one account for all services.
9. Create Application Profile for The web Application Deployment , in General tab call it “ Incentive web Application” , select OS compatibility for this Application profile
10. Select Application Configuration –> Add web application –>Select web Application and assign it a name “incentive web Application”
Click Browse and select the incentivewebapplication.zip package
12. in the setting section Double click the MSSQLConnectionString type in the name of The SQL Server instance that will be deployed for this application “ISQL01” then Click Ok, if you want to change the password or user name you will need to modify the corresponding SQL Script.
NOTE: connection string cannot contain at sign (“@”); to express literal at sign (“@”), use double at sign (“@@”). This is true for most of templates setting is SCVMM , the @ is used to define service setting , for more information about service setting check this post SC VMM 2012 Service Settings
server=ISQL01;database=incentive;user=incentiveuser;password=P@@ssw0rd
13. Click ADD Button and select script ( this script will install web deploy package to your web server)
Script command type: Preinstall
Executable Program: cmd.exe
Parameters: /q /c installwebdeploy.cmd
script resource package: Webdeploy package
Run as Account : Account with Administrative privilege
NOTE: Patch file name in parameters is coming from VMM library web deploy package folder
Click OK.
14. Create Application Profile for incentive DAC package, call it Incentive DAC Package in general , select SQL Server Application Host in the compatibility Drop box.
15. Select Application configuration , click Add and Select SQL server Data-tier Application , Select check boxes for OS compatibility.
16. Select the SQL server Data-tier Application , Give it a Name (incentive SQL Server Data-Tier) ,
click Browse and Select you’re the incentive.dacpac package .
SQLDAC Instance Name:Incentive
Authentication type: windows Authentication
SQL deployment Account: SQL Windows Authentication SA Account
Note: The SQLDAC Instance Name will be used as the DB Name in SQL
17. Select SQL Server Scripts click Add , in the SQL Script details
SQL Server Script type
ost-Install
Data Base name:
SQL Server Authentication type: windows Authentication
SQL Server Script:Createdandenableuserincentive.sql
log file path:c:\windows\temp\sqlscript.txt
Deployment Run as Account: SQL Windows Authentication SA Account
18. Click OK –> Ok
Move to Part 2 Of This Blog.
Thanks a Lot.. Kirpal Singh
Pingback: Deploying MS PetShop 4 using SCVMM 2012 service template | Private Cloud & Virtulazation