ASPState Database

Octopus.Script exported 2015-06-03 by bobjwalker belongs to ‘ASP.NET’ category.

This uses the .Net framework aspnet_regsql tool to create an ASPState database using the credentials provided. If the username and password are both empty then it will attempt a trusted connection.

Parameters

When steps based on the template are included in a project’s deployment process, the parameters below can be set.

Framework Directory

FrameworkDirectory = Framework64\v4.0.30319

Used to switch between different bitness and versions of the .Net framework

Sql Server

SqlServer

SQL Server Instance with Port

Sql Username (optional)

SqlUsername

The SQL Account which has access to create a SQL Database

Sql Password (optional)

SqlPassword

The password for the SQL Account

Script body

Steps based on this template will execute the following PowerShell script.

$command = "$env:windir\Microsoft.NET\$FrameworkDirectory\aspnet_regsql.exe"
$params = @('-ssadd', '-sstype', 'p', '-S', $SqlServer)
try
{    
    if ($SqlUsername -ne $null -and $SqlPassword -ne $null)
    {
        $params += @('-U', $SqlUsername, '-P', $SqlPassword)
    } else {
        $params += @('-E')
    }
    
    & $command @params
}
catch
{    
    $error[0] | format-list -force
    Exit 1
}

Provided under the Apache License version 2.0.

Report an issue

To use this template in Octopus Deploy, copy the JSON below and paste it into the Library → Step templates → Import dialog.

{
  "Id": "c81e85e0-0b72-478e-a776-1c658fe696a1",
  "Name": "ASPState Database",
  "Description": "This uses the .Net framework aspnet_regsql tool to create an ASPState database using the credentials provided. If the username and password are both empty then it will attempt a trusted connection.",
  "Version": 6,
  "ExportedAt": "2015-06-03T16:12:08.806+00:00",
  "ActionType": "Octopus.Script",
  "Author": "bobjwalker",
  "Parameters": [
    {
      "Name": "FrameworkDirectory",
      "Label": "Framework Directory",
      "HelpText": "Used to switch between different bitness and versions of the .Net framework",
      "DefaultValue": "Framework64\\v4.0.30319",
      "DisplaySettings": {
        "Octopus.ControlType": "Select",
        "Octopus.SelectOptions": "Framework\\v2.0.50727| .NET Framework Ver 2.0/3.0/3.5 (32-bit)\nFramework64\\v2.0.50727| .NET Framework ver 2.0/3.0/3.5 (64-bit)\nFramework\\v4.0.30319| .NET Framework version 4 (32-bit)\nFramework64\\v4.0.30319| .NET Framework version 4 (64-bit)"
      }
    },
    {
      "Name": "SqlServer",
      "Label": "Sql Server",
      "HelpText": "SQL Server Instance with Port",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      }
    },
    {
      "Name": "SqlUsername",
      "Label": "Sql Username (optional)",
      "HelpText": "The SQL Account which has access to create a SQL Database",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      }
    },
    {
      "Name": "SqlPassword",
      "Label": "Sql Password (optional)",
      "HelpText": "The password for the SQL Account",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      }
    }
  ],
  "Properties": {
    "Octopus.Action.Script.ScriptBody": "$command = \"$env:windir\\Microsoft.NET\\$FrameworkDirectory\\aspnet_regsql.exe\"\n$params = @('-ssadd', '-sstype', 'p', '-S', $SqlServer)\ntry\n{    \n    if ($SqlUsername -ne $null -and $SqlPassword -ne $null)\n    {\n        $params += @('-U', $SqlUsername, '-P', $SqlPassword)\n    } else {\n        $params += @('-E')\n    }\n    \n    & $command @params\n}\ncatch\n{    \n    $error[0] | format-list -force\n    Exit 1\n}",
    "Octopus.Action.Script.Syntax": "PowerShell"
  },
  "Category": "ASP.NET",
  "HistoryUrl": "https://github.com/OctopusDeploy/Library/commits/master/step-templates//opt/buildagent/work/75443764cd38076d/step-templates/aspnet-state-database.json",
  "Website": "/step-templates/c81e85e0-0b72-478e-a776-1c658fe696a1",
  "Logo": "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAMAAACahl6sAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAwBQTFRF////ZsTuFHO0FVSaFJTYAAAAY8z0FH3AWcfziMfsF4zTFHq9GYrQTZjOG4jOHKLiB5vhDYPLHIXJ2vH7NJzdecvxRqni5PX8HK3renp6JY3SLKnmWsPuMbLrjbDaM6rlKq3pJK3pD3a+KZHVpNv1qOP5O7LpR6TcDn3FVL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4a/ujO1CdZMt2lTlf18xaVG+28XBxdHO3DvheW/vurr7o9Tpt+WWJ5P2nypgsXf/oz+zQU+eK5STyIuFZKcckHFBh+uHbt2AmdX9kveAFh0C273z2Nb82yDK18EsTxX9/YEzVx4DG1q4QvbpeVKX7haxR3LSgUCoVCoVAoFAqFQqFQKBQKhUKhUCgUCoVCoVAoFAqFQqFQKBQKhUKhUCgUCoVCeSb+L8AAULotxGyLK9IAAAAASUVORK5CYII=",
  "$Meta": {
    "Type": "ActionTemplate"
  }
}

History

Page updated on Wednesday, June 3, 2015