Unattended Installs

    In some cases, you might need to install one or multiple Umbraco instances automatically without having to run through the installation wizard to configure the instance.

    You can use the Unattended installs feature to allow for quick installation and set up of Umbraco instances on something like Azure Web Apps.

    This article will give you the details you need to install Umbraco unattended.

    Get clean install of Umbraco

    In order to get a clean instance of Umbraco either follow our installation guide for how to Install an Umbraco project template or download a zip file directly from Downloads.

    Configure your database

    As you will not be running through the installation wizard when using the unattended installs feature, you need to manually tell Umbraco which database to use.

    • Set up and configure a new database - see Requirements for details.
    • Add the connection string using configuration.

    Umbraco can create a SQL Server database for you during the unattended install process if the user specified by the credentials in your connection string has the CREATE DATABASE permission granted and the global setting InstallMissingDatabase is set to true.

    If your connection string is for SQL CE or SQL Server Express LocalDB it is assumed that a database should be created when missing regardless of the value of the InstallMissingDatabase setting.

    Example in appsettings.json

    {
      "ConnectionStrings": {
        "umbracoDbDSN": "server=localhost;database=UmbracoUnicore;user id=sa;password='[email protected]'"
      }
    }

    Enable the unattended installs feature

    The unattended installs feature is disabled by default and in order to enable it, you need to add the following JSON object to a JSON configuration source.

    {
      "Umbraco": {
        "CMS": {
          "Unattended": {
            "InstallUnattended": true,
            "UnattendedUserName": "FRIENDLY_NAME",
            "UnattendedUserEmail": "EMAIL",
            "UnattendedUserPassword": "PASSWORD"
          }
        }
      }
    }

    Remember to set the value of InstallUnattended to true.

    Alternatively you may set your configuration with Environment Variables or other means. Learn more about this in the Microsoft .Net Core config documentation.

    The keys for this would then be as follows:

    Umbraco__CMS__Unattended__InstallUnattended
    Umbraco__CMS__Unattended__UnattendedUserName
    Umbraco__CMS__Unattended__UnattendedUserEmail
    Umbraco__CMS__Unattended__UnattendedUserPassword

    Initialize the unattended install

    After completing the steps above you can now initialize the installation by booting up the Umbraco instance.

    Once it has completed, you should see the following when visiting the frontend of the site.

    Frontend of Umbraco site installed using the unattended installs feature

    Configuration options

    Depending on your preferences, you can use any type of configuration to specify the connection string and login information, as well as enable unattended install. With the extending configuration functionality, it is possible to read from all kinds of sources. One example can be using a JSON file or environment variables.

    Program.cs has a condition, which if met, an appsettings.Local.json file will be added and configured as a configuration source.

    #if DEBUG
      .ConfigureAppConfiguration(config
        => config.AddJsonFile(
          "appsettings.Local.json",
          optional: true,
          reloadOnChange: true))
    #endif
    

    Having intellisense will help you to easily add your connection string and information needed for the unattended install.

    {
        "ConnectionStrings": {
            "umbracoDbDSN": "server=localhost;database=UmbracoUnicore;user id=sa;password='[email protected]'"
        },
        "Umbraco": {
            "CMS": {
                "Unattended": {
                    "InstallUnattended": true,
                    "UnattendedUserName": "FRIENDLY_NAME",
                    "UnattendedUserEmail": "EMAIL",
                    "UnattendedUserPassword": "PASSWORD"
                }
            }
        }
    }

    More support

    We have added support for unattended installs with Name, Email and Password, and Connection String as CLI params, which are also available in Visual Studio. There you can fill in your information as follows:

    CLI

    dotnet new umbraco -n MyNewProject --friendly-name "Friendly User" --email [email protected] --password password1234 --connection-string "Server=(localdb)\Umbraco;Database=MyDatabase;Integrated Security=true" --version 9.0.0

    Visual Studio

    Set up unattended install through Visual Studio