Skip to main content

A connection was successfully established with the server, but then an error occurred during the login process.

 While I was installing Sitecore 10.1.2 XP01, I was getting this error "A connection was successfully established with the server, but then an error occurred during the login process".


Install-SitecoreConfiguration : A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that
is not trusted.)
At C:\Swati\Sitecore\Sitecore 10.1.2 rev. 006578 (WDP XP1 packages)\XP1-SingleDeveloper.ps1:152 char:1
+ Install-SitecoreConfiguration @XP1Parameters *>&1 | Tee-Object XP1-Si ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration

[TIME] 00:02:21
Invoke-Sqlcmd : A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)
At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\2.3.0\Public\Install-SitecoreConfiguration.ps1:641 char:25
+                         & $entry.Task.Command @paramSet | Out-Default
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Invoke-Sqlcmd], SqlException
    + FullyQualifiedErrorId : SqlExceptionError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand




Solution:
  1. Inside the "XP1 Configuration files 10.1.2 rev. 006578" folder there will be a "xconnect-xp1-collection.json" file. 
  2. Open "xconnect-xp1-collection.json" file.
  3. Find CreateShardApplicationDatabaseServerLoginInvokeSqlCmd, CreateShardManagerApplicationDatabaseUserInvokeSqlCmd, CreateShard0ApplicationDatabaseUserInvokeSqlCmd, CreateShard1ApplicationDatabaseUserInvokeSqlCmd.
  4. Then add ""TrustServerCertificate": true"  
  5. The file will look like below:

 {  
   "Parameters": {  
     "Package": {  
       "Type": "string",  
       "Description": "The path to the Web Deploy package to deploy.",  
       "DefaultValue": ""  
     },  
     "LicenseFile": {  
       "Type": "string",  
       "Description": "The path to the Sitecore license file.",  
       "DefaultValue": ".\\License.xml"  
     },  
     "SiteName": {  
       "Type": "string",  
       "DefaultValue": "XConnectCollection",  
       "Description": "The name of the site to be deployed."  
     },  
     "SitePhysicalRoot": {  
       "Type": "String",  
       "Description": "Root folder to install the site to. If left on the default [systemdrive]:\\inetpub\\wwwroot will be used.",  
       "DefaultValue": ""  
     },  
     "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": ""  
     },  
     "XConnectCert": {  
       "Type": "string",  
       "Description": "The certificate to use for encryption. Provide the name or the thumbprint.",  
       "DefaultValue": ""  
     },  
     "SqlDbPrefix": {  
       "Type": "string",  
       "Description": "The prefix used for all Sql databases.",  
       "DefaultValue": ""  
     },  
     "SqlAdminUser": {  
       "Type": "string",  
       "DefaultValue": "sa",  
       "Description": "The Sql admin user account to use when installing databases."  
     },  
     "SqlAdminPassword": {  
       "Type": "string",  
       "DefaultValue": "12345",  
       "Description": "The Sql admin password to use when installing databases."  
     },  
     "SqlCollectionUser": {  
       "Type": "string",  
       "DefaultValue": "collectionuser",  
       "Description": "The Sql admin user account to use when installing databases."  
     },  
     "SqlCollectionPassword": {  
       "Type": "string",  
       "DefaultValue": "SIF-Default",  
       "Description": "The Sql admin password to use when installing databases."  
     },  
     "SqlReferenceDataUser": {  
       "Type": "string",  
       "DefaultValue": "referencedatauser",  
       "Description": "The Sql user for the Reference Data connection string in Sitecore."  
     },  
     "SqlReferenceDataPassword": {  
       "Type": "string",  
       "DefaultValue": "SIF-Default",  
       "Description": "The Sql password for the Reference Data connection string in Sitecore."  
     },  
     "SqlProcessingPoolsUser": {  
       "Type": "string",  
       "DefaultValue": "poolsuser",  
       "Description": "The Sql user for the Processing Pools connection string in Sitecore."  
     },  
     "SqlProcessingPoolsPassword": {  
       "Type": "string",  
       "DefaultValue": "SIF-Default",  
       "Description": "The Sql password for the Processing Pools connection string in Sitecore."  
     },  
     "SqlMarketingAutomationUser": {  
       "Type": "string",  
       "DefaultValue": "marketingautomationuser",  
       "Description": "The Sql user for the Marketing Automation connection string in Sitecore."  
     },  
     "SqlMarketingAutomationPassword": {  
       "Type": "string",  
       "DefaultValue": "SIF-Default",  
       "Description": "The Sql password for the Marketing Automation connection string in Sitecore."  
     },  
     "SqlMessagingUser": {  
       "Type": "string",  
       "DefaultValue": "messaginguser",  
       "Description": "The Sql user for the Messaging connection string in Sitecore."  
     },  
     "SqlMessagingPassword": {  
       "Type": "string",  
       "DefaultValue": "SIF-Default",  
       "Description": "The Sql password for the Messaging connection string in Sitecore."  
     },  
     "SqlServer": {  
       "Type": "string",  
       "DefaultValue": ".\\SQLSERVER",  
       "Description": "The Sql Server where databases will be installed."  
     },  
     "XConnectEnvironment": {  
       "Type": "string",  
       "DefaultValue": "Development",  
       "Description": "The configuration environment for this instance."  
     },  
     "XConnectLogLevel": {  
       "Type": "string",  
       "DefaultValue": "Information",  
       "Description": "The level of log information to output."  
     },  
     "HostMappingName": {  
       "Type": "string",  
       "Reference": "SiteName",  
       "Description": "The host mapping name of the site."  
     },  
     "DnsName" :{  
       "Type": "string",  
       "Reference": "SiteName",  
       "Description": "The dns name of the site."  
     },  
     "SkipDatabaseInstallation": {  
       "Type": "bool",  
       "DefaultValue": false,  
       "Description": "Skip database installation."  
     },  
     "PackagesTempLocation": {  
       "Type": "String",  
       "Description": "Alternative location to save WDP packages. If left on the default $Env:Temp will be used.",  
       "DefaultValue": "",  
       "Validate": "[TestPath(variable('Temp.Location'))]"  
     },  
     "DownloadLocations": {  
       "Type": "String",  
       "Description": "File with URI and SHA256 hashes of dynamically downloadable WDPs.",  
       "DefaultValue": ".\\downloads.json"  
     },  
     "Update": {  
       "Type": "bool",  
       "Description": "The parameter for the installing delta WDP packages.",  
       "DefaultValue": false  
     }  
   },  
   "Variables": {  
     "Sharding.Database.Prefix": "[concat(parameter('SqlDbPrefix'), '_Xdb.Collection.Shard')]",  
     "Sql.Database.ShardMapManager":   "[concat(variable('Sharding.Database.Prefix'), 'MapManager')]",  
     "Sql.Database.Shard0":       "[concat(variable('Sharding.Database.Prefix'), '0')]",  
     "Sql.Database.Shard1":       "[concat(variable('Sharding.Database.Prefix'), '1')]",  
     "Sql.Database.Pools":        "[concat(parameter('SqlDbPrefix'), '_Processing.Pools')]",  
     "Sql.Database.MarketingAutomation": "[concat(parameter('SqlDbPrefix'), '_MarketingAutomation')]",  
     "Sql.Database.Messaging": "[concat(parameter('SqlDbPrefix'), '_Messaging')]",  
     "Sql.Database.Reference": "[concat(parameter('SqlDbPrefix'), '_ReferenceData')]",  
     "SqlMarketingAutomation.Password": "[parameter('SqlMarketingAutomationPassword'))]",  
     "SqlMessaging.Password": "[parameter('SqlMessagingPassword'))]",  
     "SqlProcessingPools.Password": "[parameter('SqlProcessingPoolsPassword'))]",  
     "SqlCollection.Password": "[parameter('SqlCollectionPassword'))]",  
     "SqlReferenceData.Password": "[parameter('SqlReferenceDataPassword')]",  
     "SqlCollection.User": "[parameter('SqlCollectionUser'))]",  
     "Security.CertificateStore": "Cert:\\Localmachine\\My",  
     "Security.SSL.CertificateThumbprint": "[GetCertificateThumbprint(parameter('SSLCert'), variable('Security.CertificateStore'))]",  
     "Security.XConnect.CertificateThumbprint": "[GetCertificateThumbprint(parameter('XConnectCert'), variable('Security.CertificateStore'))]",  
     "Security.XConnect.CertificatePath":    "[joinpath(variable('Security.CertificateStore'), variable('Security.XConnect.CertificateThumbprint'))]",  
     "Site.PhysicalPath": "[if(variable('Test.Site.PhysicalPath'),variable('Default.Site.PhysicalPath'),variable('Custom.Site.PhysicalPath'))]",  
     "Default.Site.PhysicalPath": "[joinpath(environment('SystemDrive'), 'inetpub', 'wwwroot', parameter('SiteName'))]",  
     "Custom.Site.PhysicalPath": "[joinpath(parameter('SitePhysicalRoot'),parameter('SiteName'))]",  
     "Test.Site.PhysicalPath": "[equal(parameter('SitePhysicalRoot'),'')]",  
     "Site.DataFolder": "[joinpath(variable('Site.PhysicalPath'), 'App_Data')]",  
     "Services.IndexWorker.InstallPath": "[joinpath(variable('Site.DataFolder'), 'jobs','continuous','IndexWorker')]",  
     "Services.IndexWorker.Name": "[concat(parameter('SiteName'), '-indexworker')]",  
     "Sharding.Root.Path":    "[joinpath(variable('Site.DataFolder'), 'collectiondeployment')]",  
     "Sharding.Tool.Path":    "[joinpath(variable('Sharding.Root.Path'), 'Sitecore.Xdb.Collection.Database.SqlShardingDeploymentTool.exe')]",  
     "Sharding.DacPac.Path":   "[joinpath(variable('Sharding.Root.Path'), 'Sitecore.Xdb.Collection.Database.Sql.dacpac')]",  
     "Sharding.DB.Connection":  "[sqlconnectionstring(parameter('SqlServer'), '', parameter('SqlAdminUser'), parameter('SqlAdminPassword'))]",  
     "Sharding.Edition":     "Basic",  
     "Sharding.SqlCmd.Path.CreateShardApplicationDatabaseServerLogin":  "[joinpath(variable('Sharding.Root.Path'), 'CreateShardApplicationDatabaseServerLogin.sql')]",  
     "Sharding.SqlCmd.Path.CreateShardManagerApplicationDatabaseUser":  "[joinpath(variable('Sharding.Root.Path'), 'CreateShardManagerApplicationDatabaseUser.sql')]",  
     "Sharding.SqlCmd.Path.CreateShardApplicationDatabaseUser":     "[joinpath(variable('Sharding.Root.Path'), 'CreateShardApplicationDatabaseUser.sql')]",  
     "Sql.Secure.Password" : "[ConvertToSecureString(String:parameter('SqlAdminPassword'),AsPlainText:true,Force:true)]",  
     "Sql.Credential": "[NewPSCredential(Username:parameter('SqlAdminUser'),Password:variable('SQL.Secure.Password'))]",  
     "Skip.dbDacFx": "[if(variable('Skip.Install.Databases'),'dbDacFx','null')]",  
     "Skip.dbFullSql": "[if(variable('Skip.Install.Databases'),'dbFullSql','null')]",  
     "Skip.Install.Databases": "[or(parameter('SkipDatabaseInstallation'),parameter('Update'))]",  
     "Temp.Location" : "[if(variable('Test.Temp.Location'),Environment('Temp'),parameter('PackagesTempLocation'))]",  
     "Test.Temp.Location" : "[equal(parameter('PackagesTempLocation'),'')]",  
     "Settings.FileName": "xconnect-xp1-collection.json",  
     "Dynamic.WDP": "[ReadJson(parameter('DownloadLocations'))]",  
     "Test.WDP.Download": "[TestPath(Path:Parameter('DownloadLocations'))]",  
     "WDP.Download": "[SelectObject(InputObject:variable('Dynamic.WDP'),ExpandProperty:variable('Settings.Filename'))]",  
     "WDP.Download.Uri": "[SelectObject(InputObject:variable('WDP.Download'),ExpandProperty:'Uri')]",  
     "WDP.Download.Hash": "[SelectObject(InputObject:variable('WDP.Download'),ExpandProperty:'Hash')]",  
     "WDP.Download.Path": "[JoinPath(variable('Temp.Location'),variable('WDP.Filename'))]",  
     "WDP.Download.Filename": "[SplitPath(Path:variable('WDP.Download.Uri'),Leaf:true)]",  
     "WDP.Filename": "[Split(String:variable('WDP.Download.Filename'),Characters:'?')]",  
     "Package": "[if(parameter('Package'),parameter('Package'),variable('WDP.Download.Path'))]",  
     "Test.Packaging": "[or(variable('Test.Null.Package'),not(variable('Test.WDP.Download')))]",  
     "Test.Null.Package": "[if(parameter('Package'),parameter('Package'),'')]"  
   },  
   "Register":{  
     "Tasks": {  
       "InvokeSqlcmd": "Invoke-Sqlcmd",  
       "RemoveItem": "Remove-Item",  
       "RemoveSQLLogin": "Remove-SQLLogin"  
     },  
     "ConfigFunction": {  
       "ConvertToSecureString": "ConvertTo-SecureString",  
       "TestPath": "Test-Path",  
       "SelectObject": "Select-Object",  
       "SplitPath": "Split-Path",  
       "GetVariable": "Get-Variable"  
     }  
   },  
   "Tasks": {  
     "DownloadWDP": {  
       "Description": "Download the WDP and verifies it against the stored hash.",  
       "Type": "DownloadFile",  
       "Params": {  
         "SourceUri": "[variable('WDP.Download.URI')]",  
         "DestinationPath": "[variable('WDP.Download.Path')]",  
         "Hash": "[variable('WDP.Download.Hash')]"  
       },  
       "Skip" : "[variable('Test.Packaging')]"  
     },  
     "CreatePaths": {  
       "Description": "Ensure the destination path for the site exists.",  
       "Type": "EnsurePath",  
       "Params": {  
         "Exists": [ "[variable('Site.PhysicalPath')]" ]  
       },  
       "Skip" : "[parameter('Update')]"  
     },  
     "CreateAppPool": {  
       "Description": "Creates or updates the app pool.",  
       "Type": "AppPool",  
       "Params": {  
         "Name": "[parameter('SiteName')]",  
         "Properties": {  
           "ProcessModel": {  
             "identityType" : "ApplicationPoolIdentity"  
           }  
         }  
       },  
       "Skip" : "[parameter('Update')]"  
     },  
     "SetAppPoolCertStorePermissions": {  
       "Description": "Set permissions for the App Pool User to access the client certificate.",  
       "Type": "FilePermissions",  
       "Params": {  
         "Path" : "[ResolveCertificatePath(variable('Security.XConnect.CertificatePath'))]",  
         "Rights": [  
           {  
             "User": "[concat('IIS AppPool\\', parameter('SiteName'))]",  
             "FileSystemRights": ["Read"],  
             "InheritanceFlags": [ "None"]  
           }  
         ]  
       },  
       "Skip" : "[parameter('Update')]"  
     },  
     "CreateWebsite": {  
       "Description": "Creates or updates the IIS website instance.",  
       "Type": "Website",  
       "Params": {  
         "Name": "[parameter('SiteName')]",  
         "ApplicationPool": "[parameter('SiteName')]",  
         "PhysicalPath": "[variable('Site.PhysicalPath')]"  
       },  
       "Skip" : "[parameter('Update')]"  
     },  
     "StopWebsite": {  
       "Description": "Stops the website if it is running.",  
       "Type": "ManageWebsite",  
       "Params": {  
         "Name": "[parameter('SiteName')]",  
         "Action": "Stop"  
       }  
     },  
     "StopAppPool": {  
       "Description": "Stops the app pool if it is running.",  
       "Type": "ManageAppPool",  
       "Params": {  
         "Name": "[parameter('SiteName')]",  
         "Action": "Stop"  
       }  
     },  
     "RemoveDefaultBinding": {  
       "Description": "Removes the default *:80 web binding.",  
       "Type": "WebBinding",  
       "Params": {  
         "SiteName" : "[parameter('SiteName')]",  
         "Remove" : [ { "Port": "80", "IPAddress": "*" } ]  
       },  
       "Skip" : "[parameter('Update')]"  
     },  
     "CreateBindingsWithThumbprint": {  
       "Description": "Configures the site bindings for the website.",  
       "Type": "WebBinding",  
       "Params": {  
         "SiteName" : "[parameter('SiteName')]",  
         "Add": [  
           {  
             "HostHeader": "[parameter('DnsName')]",  
             "Protocol": "https",  
             "SSLFlags": 1,  
             "Thumbprint": "[variable('Security.SSL.CertificateThumbprint')]"  
           }  
         ]  
       },  
       "Skip": "[or(not(parameter('SSLCert')),parameter('Update'))]"  
     },  
     "SetClientCertificatePermissions": {  
       "Type": "WebsiteClientCert",  
       "Params": {  
         "SiteName": "[parameter('SiteName')]",  
         "Setting": "Accept"  
       },  
       "Skip" : "[parameter('Update')]"  
     },  
     "SupportListManagerLargeUpload":{  
       "Type": "IISConfiguration",  
       "Params": {  
         "SiteName": "[parameter('SiteName')]",  
         "ConfigPath": "system.webServer/serverRuntime",  
         "Key": "uploadReadAheadSize",  
         "Value": 491520000  
       },  
       "Skip" : "[parameter('Update')]"  
     },  
     "CreateHostHeader": {  
       "Description": "Sets a hostheader for the website.",  
       "Type": "HostHeader",  
       "Params": {  
         "HostName": "[parameter('HostMappingName')]"  
       },  
       "Skip": "[or(not(parameter('HostMappingName')),parameter('Update'))]"  
     },  
     "SetPermissions": {  
       "Description": "Sets permissions for the app pool user.",  
       "Type": "FilePermissions",  
       "Params": {  
         "Path" : "[variable('Site.PhysicalPath')]",  
         "Rights": [  
           {  
             "User": "[concat('IIS AppPool\\', parameter('SiteName'))]",  
             "FileSystemRights": "FullControl",  
             "InheritanceFlags": [ "ContainerInherit", "ObjectInherit"]  
           }  
         ]  
       },  
       "Skip" : "[parameter('Update')]"  
     },  
     "InstallWDP": {  
       "Description": "Syncs the web deploy package with the website.",  
       "Type": "WebDeploy",  
       "Params" : {  
         "Verb": "Sync",  
         "Arguments": {  
           "Source": { "Package": "[resolvepath(variable('Package'))]" },  
           "Dest": "Auto",  
           "enableRule": "DoNotDeleteRule",  
           "SetParam": [  
             { "Name": "IIS Web Application Name", "Value": "[parameter('SiteName')]" },  
             { "Name": "Database Server Name", "Value": "[parameter('SqlServer')]" },  
             { "Name": "Database Admin User Name", "Value": "[parameter('SqlAdminUser')]" },  
             { "Name": "Database Admin User Password", "Value": "[parameter('SqlAdminPassword')]" },  
             { "Name": "Collection Database Server Name", "Value": "[parameter('SqlServer')]" },  
             { "Name": "Collection Shard Map Manager Database Name", "Value": "[variable('Sql.Database.ShardMapManager')]" },  
             { "Name": "Collection Shard 0 Database Name", "Value": "[variable('Sql.Database.Shard0')]" },  
             { "Name": "Collection Shard 1 Database Name", "Value": "[variable('Sql.Database.Shard1')]" },  
             { "Name": "Processing Pools Database Name", "Value": "[variable('Sql.Database.Pools')]" },  
             { "Name": "Marketing Automation Database Name", "Value": "[variable('Sql.Database.MarketingAutomation')]" },  
             { "Name": "Messaging Database Name", "Value": "[variable('Sql.Database.Messaging')]" },  
             { "Name": "Reference Data Database Name", "Value": "[variable('Sql.Database.Reference')]" },  
             { "Name": "Collection Database Application User Name", "Value": "[variable('SqlCollection.User')]" },  
             { "Name": "Collection Database Application User Password", "Value": "[variable('SqlCollection.Password')]" },  
             { "Name": "Processing Pool Database Application User Name", "Value": "[parameter('SqlProcessingPoolsUser')]" },  
             { "Name": "Processing Pool Database Application User Password", "Value": "[variable('SqlProcessingPools.Password')]" },  
             { "Name": "Marketing Automation Database Application User Name", "Value": "[parameter('SqlMarketingAutomationUser')]" },  
             { "Name": "Marketing Automation Database Application User Password", "Value": "[variable('SqlMarketingAutomation.Password')]" },  
             { "Name": "Messaging Database Application User Name", "Value": "[parameter('SqlMessagingUser')]" },  
             { "Name": "Messaging Database Application User Password", "Value": "[variable('SqlMessaging.Password')]" },  
             { "Name": "Reference Data Database Application User Name", "Value": "[parameter('SqlReferenceDataUser')]" },  
             { "Name": "Reference Data Database Application User Password", "Value": "[variable('SqlReferenceData.Password')]" },  
             { "Name": "XConnect Server Configuration Environment", "Value": "[parameter('XConnectEnvironment')]" },  
             { "Name": "XConnect Server Certificate Validation Thumbprint", "Value": "[variable('Security.XConnect.CertificateThumbprint')]" },  
             { "Name": "XConnect Server Log Level", "Value": "[parameter('XConnectLogLevel')]" }  
           ],  
           "Skip":[  
             {"ObjectName": "[variable('Skip.dbDacFx')]"},  
             {"ObjectName": "[variable('Skip.dbFullSql')]"}  
           ]  
         }  
       }  
     },  
     "SetLicense" : {  
       "Description": "Copies the license file to the instance data folder.",  
       "Type": "Copy",  
       "Params": {  
         "Source": "[resolvepath(parameter('LicenseFile'))]",  
         "Destination": "[variable('Site.DataFolder')]"  
       },  
       "Skip" : "[parameter('Update')]"  
     },  
     "CreateBindingsWithDevelopmentThumbprint": {  
       "Description": "Creates a new thumbprint with a custom CA.",  
       "Type": "AddWebFeatureSSL",  
       "Params": {  
         "SiteName": "[parameter('SiteName')]",  
         "HostName": "[parameter('DnsName')]",  
         "OutputDirectory": "[variable('Site.DataFolder')]"  
       },  
       "Skip": "[or(parameter('SSLCert'),parameter('Update'))]"  
     },  
     "CleanShards" : {  
       "Description": "Drop existing shards.",  
       "Type": "Command",  
       "Params": {  
         "Path": "[variable('Sharding.Tool.Path')]",  
         "Arguments":[  
           "/operation", "drop",  
           "/connectionstring", "[variable('Sharding.DB.Connection')]",  
           "/shardMapManagerDatabaseName", "[variable('Sql.Database.ShardMapManager')]"  
         ],  
         "TaskName" : "ShardingTool - Clean"  
       },  
       "Skip": "[or(parameter('SkipDatabaseInstallation'),parameter('Update'))]"  
     },  
     "CreateShards": {  
       "Description": "Create new shards.",  
       "Type": "Command",  
       "Params": {  
         "Path": "[variable('Sharding.Tool.Path')]",  
         "Arguments":[  
           "/operation", "create",  
           "/connectionstring", "[variable('Sharding.DB.Connection')]",  
           "/shardMapManagerDatabaseName", "[variable('Sql.Database.ShardMapManager')]",  
           "/dbedition", "[variable('Sharding.Edition')]",  
           "/shardnumber", 2,  
           "/shardnameprefix", "[variable('Sharding.Database.Prefix')]",  
           "/shardnamesuffix", "\"\"",  
           "/dacpac", "[variable('Sharding.DacPac.Path')]"  
         ],  
         "TaskName" : "ShardingTool - Create"  
       },  
       "Skip": "[or(parameter('SkipDatabaseInstallation'),parameter('Update'))]"  
     },  
     "CreateShardApplicationDatabaseServerLoginInvokeSqlCmd": {  
       "Description": "Create Collection Shard Database Server Login.",  
       "Type": "InvokeSqlcmd",  
       "Params": {  
         "ServerInstance": "[parameter('SqlServer')]",  
                     "TrustServerCertificate": true  
         "Credential": "[variable('Sql.Credential')]",  
         "InputFile": "[variable('Sharding.SqlCmd.Path.CreateShardApplicationDatabaseServerLogin')]",  
         "Variable": [  
           "[concat('UserName=',variable('SqlCollection.User'))]",  
           "[concat('Password=',variable('SqlCollection.Password'))]"  
         ]  
       },  
       "Skip": "[or(parameter('SkipDatabaseInstallation'),parameter('Update'))]"  
     },  
     "CreateShardManagerApplicationDatabaseUserInvokeSqlCmd": {  
       "Description": "Create Collection Shard Manager Database User.",  
       "Type": "InvokeSqlcmd",  
       "Params": {  
         "ServerInstance": "[parameter('SqlServer')]",  
                     "TrustServerCertificate": true  
         "Credential": "[variable('Sql.Credential')]",  
         "Database": "[variable('Sql.Database.ShardMapManager')]",  
         "InputFile": "[variable('Sharding.SqlCmd.Path.CreateShardManagerApplicationDatabaseUser')]",  
         "Variable": [  
           "[concat('UserName=',variable('SqlCollection.User'))]",  
           "[concat('Password=',variable('SqlCollection.Password'))]"  
         ]  
       },  
       "Skip": "[or(parameter('SkipDatabaseInstallation'),parameter('Update'))]"  
     },  
     "CreateShard0ApplicationDatabaseUserInvokeSqlCmd": {  
       "Description": "Create Collection Shard 0 Database User.",  
       "Type": "InvokeSqlcmd",  
       "Params": {  
         "ServerInstance": "[parameter('SqlServer')]",  
                     "TrustServerCertificate": true  
         "Credential": "[variable('Sql.Credential')]",  
         "Database": "[variable('Sql.Database.Shard0')]",  
         "InputFile": "[variable('Sharding.SqlCmd.Path.CreateShardApplicationDatabaseUser')]",  
         "Variable": [  
           "[concat('UserName=',variable('SqlCollection.User'))]",  
           "[concat('Password=',variable('SqlCollection.Password'))]"  
         ]  
       },  
       "Skip": "[or(parameter('SkipDatabaseInstallation'),parameter('Update'))]"  
     },  
     "CreateShard1ApplicationDatabaseUserInvokeSqlCmd": {  
       "Description": "Create Collection Shard 1 Database User.",  
       "Type": "InvokeSqlcmd",  
       "Params": {  
         "ServerInstance": "[parameter('SqlServer')]",  
                     "TrustServerCertificate": true  
         "Credential": "[variable('Sql.Credential')]",  
         "Database": "[variable('Sql.Database.Shard1')]",  
         "InputFile": "[variable('Sharding.SqlCmd.Path.CreateShardApplicationDatabaseUser')]",  
         "Variable": [  
           "[concat('UserName=',variable('SqlCollection.User'))]",  
           "[concat('Password=',variable('SqlCollection.Password'))]"  
         ]  
       },  
       "Skip": "[or(parameter('SkipDatabaseInstallation'),parameter('Update'))]"  
     },  
     "StartAppPool": {  
       "Description":"Starts the app pool.",  
       "Type": "ManageAppPool",  
       "Params": {  
         "Name": "[parameter('SiteName')]",  
         "Action": "Start"  
       }  
     },  
     "StartWebsite": {  
       "Description":"Starts the website.",  
       "Type": "ManageWebsite",  
       "Params": {  
         "Name": "[parameter('SiteName')]",  
         "Action": "Start"  
       }  
     }  
   },  
   "UninstallTasks": {  
     "StopWebsite": {  
       "Description": "Stops the website if it is running.",  
       "Type": "ManageWebsite",  
       "Params": {  
         "Name": "[parameter('SiteName')]",  
         "Action": "Stop",  
         "ErrorAction": "SilentlyContinue"  
       }  
     },  
     "StopAppPool": {  
       "Description": "Stops the app pool if it is running.",  
       "Type": "ManageAppPool",  
       "Params": {  
         "Name": "[parameter('SiteName')]",  
         "Action": "Stop",  
         "ErrorAction": "SilentlyContinue"  
       }  
     },  
     "RemoveWebsite": {  
       "Description": "Removes the IIS website.",  
       "Type": "RemoveWebsite",  
       "Params": {  
         "Name": "[parameter('SiteName')]"  
       }  
     },  
     "RemoveAppPool": {  
       "Description": "Removes the IIS application pool.",  
       "Type": "RemoveAppPool",  
       "Params": {  
         "Name": "[parameter('SiteName')]"  
       }  
     },  
     "RemoveContent": {  
       "Description": "Removes website content.",  
       "Type": "RemoveItem",  
       "Params": {  
         "Path": "[variable('Site.PhysicalPath')]",  
         "Recurse": true,  
         "ErrorAction": "SilentlyContinue"  
       }  
     },  
     "RemoveHostHeader": {  
       "Description": "Removes the website host name.",  
       "Type": "HostHeader",  
       "Params": {  
         "HostName": "[parameter('SiteName')]",  
         "Action": "Remove"  
       }  
     },  
     "RemoveDatabases": {  
       "Description": "Removes the databases.",  
       "Type": "RemoveSQLDatabase",  
       "Params": {  
         "ServerName": "[parameter('SqlServer')]",  
         "Username": "[parameter('SqlAdminUser')]",  
         "Password": "[variable('Sql.Secure.Password')]",  
         "DatabaseName": [  
           "[variable('Sql.Database.ShardMapManager')]",  
           "[variable('Sql.Database.Shard0')]",  
           "[variable('Sql.Database.Shard1')]",  
           "[variable('Sql.Database.Pools')]",  
           "[variable('Sql.Database.MarketingAutomation')]",  
           "[variable('Sql.Database.Messaging')]"  
         ]  
       }  
     },  
     "RemoveLogin":{  
       "Description": "Removes the sqlcollectionuser login from the database server.",  
       "Type": "RemoveSQLLogin",  
       "Params": {  
         "LoginName": "[variable('SqlCollection.User')]",  
         "ServerInstance": "[parameter('SqlServer')]",  
         "Credential": "[variable('Sql.Credential')]",  
         "Force": true,  
         "ErrorAction": "SilentlyContinue"  
       }  
     }  
   }  
 }  

Comments