Pipelines/Steps/Install/OnPrem/Sitecore/XP/Scaled/9.0/2/sitecore-XP1-rep.json

{
    "Parameters": {
        "Package": {
            "Type": "string",
            "Description": "The path to the Web Deploy package to deploy."
        },
        "LicenseFile": {
            "Type": "string",
            "Description": "The path to the Sitecore license file."
        },
        "SSLCert": {
            "Type": "string",
            "Description": "The certificate to use for HTTPS web bindings. Provide the name or the thumbprint. If not provided a certificate will be generated.",
            "DefaultValue": ""
        },
        "SqlDbPrefix": {
            "Type": "string",
            "Description": "The prefix used for all Sql databases.",
            "DefaultValue": ""
        },
        "SiteName": {
            "Type": "string",
            "DefaultValue": "SitecoreReporting",
            "Description": "The name of the site to be deployed."
        },
        "SqlCoreUser": {
            "Type": "string",
            "DefaultValue": "coreuser",
            "Description": "The Sql user for the Core connection string in Sitecore."
        },
        "SqlCorePassword": {
            "Type": "string",
            "DefaultValue": "Test12345",
            "Description": "The Sql password for the Core connection string in Sitecore."
        },
        "SqlMasterUser": {
            "Type": "string",
            "DefaultValue": "masteruser",
            "Description": "The Sql user for the Master connection string in Sitecore."
        },
        "SqlMasterPassword": {
            "Type": "string",
            "DefaultValue": "Test12345",
            "Description": "The Sql password for the Master connection string in Sitecore."
        },
        "SqlWebUser": {
            "Type": "string",
            "DefaultValue": "webuser",
            "Description": "The Sql user for the Web connection string in Sitecore."
        },
        "SqlWebPassword": {
            "Type": "string",
            "DefaultValue": "Test12345",
            "Description": "The Sql password for the Web connection string in Sitecore."
        },
        "SqlReportingUser": {
            "Type": "string",
            "DefaultValue": "reportinguser",
            "Description": "The Sql user for the Reporting connection string in Sitecore."
        },
        "SqlReportingPassword": {
            "Type": "string",
            "DefaultValue": "Test12345",
            "Description": "The Sql password for the Reporting connection string in Sitecore."
        },
        "SqlServer": {
            "Type": "string",
            "DefaultValue": ".\\SQLSERVER",
            "Description": "The Sql Server where databases will be installed."
        },
        "ReportingServiceApiKey": {
            "Type": "string",
            "DefaultValue": "abcde111112222233333444445555566",
            "Description": "The api key to use with the Reporting Service server."
        },
        "InstallDirectory": {
            "Type": "string",
            "Description": "Installation directory"
        }
    },
    "Variables": {
        "Sql.Database.Core": "[concat(parameter('SqlDbPrefix'), '_Core')]",
        "Sql.Database.Master": "[concat(parameter('SqlDbPrefix'), '_Master')]",
        "Sql.Database.Web": "[concat(parameter('SqlDbPrefix'), '_Web')]",
        "Sql.Database.Reporting": "[concat(parameter('SqlDbPrefix'), '_Reporting')]",
        "Security.CertificateStore": "Cert:\\Localmachine\\My",
        "Security.SSL.CertificateThumbprint": "[GetCertificateThumbprint(parameter('SSLCert'), variable('Security.CertificateStore'))]",
        "Site.PhysicalPath": "[parameter('InstallDirectory')]",
        "Site.DataFolder": "[joinpath(variable('Site.PhysicalPath'), 'App_Data')]"
    },
    "Tasks": {
        "CreatePaths": {
            "Type": "EnsurePath",
            "Params": {
                "Exists": [
                    "[variable('Site.PhysicalPath')]"
                ]
            }
        },
        "CreateAppPool": {
            "Type": "AppPool",
            "Params": {
                "Name": "[parameter('SiteName')]",
                "Properties": {
                    "ProcessModel": {
                        "identityType": "ApplicationPoolIdentity"
                    }
                }
            }
        },
        "CreateWebsite": {
            "Type": "Website",
            "Params": {
                "Name": "[parameter('SiteName')]",
                "ApplicationPool": "[parameter('SiteName')]",
                "PhysicalPath": "[variable('Site.PhysicalPath')]"
            }
        },
        "StopWebsite": {
            "Type": "ManageWebsite",
            "Params": {
                "Name": "[parameter('SiteName')]",
                "Action": "Stop"
            }
        },
        "StopAppPool": {
            "Type": "ManageAppPool",
            "Params": {
                "Name": "[parameter('SiteName')]",
                "Action": "Stop"
            }
        },
        "RemoveDefaultBinding": {
            "Type": "WebBinding",
            "Params": {
                "SiteName": "[parameter('SiteName')]",
                "Remove": [
                    {
                        "Port": "80",
                        "IPAddress": "*"
                    }
                ]
            }
        },
        "CreateBindingsWithThumprint": {
            "Type": "WebBinding",
            "Params": {
                "SiteName": "[parameter('SiteName')]",
                "Add": [
                    {
                        "HostHeader": "[parameter('SiteName')]",
                        "Protocol": "https",
                        "SSLFlags": 1,
                        "Thumbprint": "[variable('Security.SSL.CertificateThumbprint')]"
                    }
                ]
            },
            "Skip": "[not(parameter('SSLCert'))]"
        },
        "CreateHostHeader": {
            "Type": "HostHeader",
            "Params": {
                "HostName": "[parameter('SiteName')]"
            }
        },
        "SetPermissions": {
            "Type": "FilePermissions",
            "Params": {
                "Path": "[variable('Site.PhysicalPath')]",
                "Rights": [
                    {
                        "User": "[concat('IIS AppPool\\', parameter('SiteName'))]",
                        "FileSystemRights": "FullControl",
                        "InheritanceFlags": [
                            "ContainerInherit",
                            "ObjectInherit"
                        ]
                    }
                ]
            }
        },
        "InstallWDP": {
            "Type": "WebDeploy",
            "Params": {
                "Verb": "Sync",
                "Arguments": {
                    "Source": {
                        "Package": "[resolvepath(parameter('Package'))]"
                    },
                    "Dest": "Auto",
                    "SetParam": [
                        {
                            "Name": "Application Path",
                            "Value": "[parameter('SiteName')]"
                        },
                        {
                            "Name": "Database Server Name",
                            "Value": "[parameter('SqlServer')]"
                        },
                        {
                            "Name": "Core DB Name",
                            "Value": "[variable('Sql.Database.Core')]"
                        },
                        {
                            "Name": "Master DB Name",
                            "Value": "[variable('Sql.Database.Master')]"
                        },
                        {
                            "Name": "Web DB Name",
                            "Value": "[variable('Sql.Database.Web')]"
                        },
                        {
                            "Name": "Reporting DB Name",
                            "Value": "[variable('Sql.Database.Reporting')]"
                        },
                        {
                            "Name": "Core DB User Name",
                            "Value": "[parameter('SqlCoreUser')]"
                        },
                        {
                            "Name": "Core DB User Password",
                            "Value": "[parameter('SqlCorePassword')]"
                        },
                        {
                            "Name": "Master DB User Name",
                            "Value": "[parameter('SqlMasterUser')]"
                        },
                        {
                            "Name": "Master DB User Password",
                            "Value": "[parameter('SqlMasterPassword')]"
                        },
                        {
                            "Name": "Web DB User Name",
                            "Value": "[parameter('SqlWebUser')]"
                        },
                        {
                            "Name": "Web DB User Password",
                            "Value": "[parameter('SqlWebPassword')]"
                        },
                        {
                            "Name": "Reporting DB User Name",
                            "Value": "[parameter('SqlReportingUser')]"
                        },
                        {
                            "Name": "Reporting DB User Password",
                            "Value": "[parameter('SqlReportingPassword')]"
                        },
                        {
                            "Name": "Reporting Service Api Key",
                            "Value": "[parameter('ReportingServiceApiKey')]"
                        }
                    ]
                }
            }
        },
        "CreateBindingsWithDevelopmentThumprint": {
            "Type": "AddWebFeatureSSL",
            "Params": {
                "HostName": "[parameter('SiteName')]",
                "OutputDirectory": "[variable('Site.DataFolder')]"
            },
            "Skip": "[parameter('SSLCert')]"
        },
        "SetLicense": {
            "Type": "Copy",
            "Params": {
                "Source": "[resolvepath(parameter('LicenseFile'))]",
                "Destination": "[variable('Site.DataFolder')]"
            }
        },
        "StartAppPool": {
            "Type": "ManageAppPool",
            "Params": {
                "Name": "[parameter('SiteName')]",
                "Action": "Start"
            }
        },
        "StartWebsite": {
            "Type": "ManageWebsite",
            "Params": {
                "Name": "[parameter('SiteName')]",
                "Action": "Start"
            }
        }
    }
}