Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nul800sebastiaan/1553316fda85011270ce2bde35243e5b to your computer and use it in GitHub Desktop.
Save nul800sebastiaan/1553316fda85011270ce2bde35243e5b to your computer and use it in GitHub Desktop.
Fully unattended Umbraco 9 + Starter Kit install with automatic DB creation in SQL server
dotnet new umbraco -n UmbracoUnattended --connection-string "Server=GORDON\SQLExpress;Database=UmbracoUnattended;User Id=sa;Password=abc123;"
cd UmbracoUnattended
Set-Item Env:\UMBRACO__CMS__GLOBAL__INSTALLMISSINGDATABASE true
Set-Item Env:\UMBRACO__CMS__UNATTENDED__INSTALLUNATTENDED true
Set-Item Env:\UMBRACO__CMS__UNATTENDED__UNATTENDEDUSERNAME "Test"
Set-Item Env:\UMBRACO__CMS__UNATTENDED__UNATTENDEDUSEREMAIL "[email protected]"
Set-Item Env:\UMBRACO__CMS__UNATTENDED__UNATTENDEDUSERPASSWORD "test123456"
dotnet add package Umbraco.TheStarterKit
dotnet run
@nul800sebastiaan
Copy link
Author

The reason we're setting env variables here is that we don't want the default credentials to end up in appsettings.Development.json - that one would be committed to git and available forever.

These variables get cleared when you restart Powershell, so they only count for 1 session.

@rsoeteman
Copy link

Thanks for sharing, great way to install Umbraco, found a snippet from @ronaldbarendse on Discord als well to use local DB instead of a SQL Server Instance. The two combined wil really speed up creating test sites for me, so both #h5yr

dotnet new umbraco -n UmbracoUnattended --connection-string "Server=(localdb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Umbraco.mdf;Integrated Security=true"

cd UmbracoUnattended

Set-Item Env:\UMBRACO__CMS__GLOBAL__INSTALLMISSINGDATABASE true
Set-Item Env:\UMBRACO__CMS__UNATTENDED__INSTALLUNATTENDED true
Set-Item Env:\UMBRACO__CMS__UNATTENDED__UNATTENDEDUSERNAME "Test"
Set-Item Env:\UMBRACO__CMS__UNATTENDED__UNATTENDEDUSEREMAIL "[email protected]"
Set-Item Env:\UMBRACO__CMS__UNATTENDED__UNATTENDEDUSERPASSWORD "test123456"

dotnet add package Umbraco.TheStarterKit
dotnet run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment