{"id":269,"date":"2020-01-09T07:27:19","date_gmt":"2020-01-09T07:27:19","guid":{"rendered":"http:\/\/fredborg.org\/?p=269"},"modified":"2021-03-01T09:35:35","modified_gmt":"2021-03-01T09:35:35","slug":"connect-local-sql-to-nav-container","status":"publish","type":"post","link":"https:\/\/fredborg.org\/?p=269","title":{"rendered":"Connect Local SQL to NAV Container"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Have you ever wanted to be able to use the easy setup of&nbsp;navcontainerhelper&nbsp;to setup your infrastructure but&nbsp;you would like to be able to connect to a \u201creal\u201d database to your&nbsp;Docker? Well look no further, in this post I will show you how you can accomplish just this. Now just a disclaimer, this is nothing new that I have come up with, there a lot of blog posts out there that shows you how to achieve&nbsp;just this, but hopefully this post will show you the easiest way for you to get from point A to B.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But why would you want to connect a Docker to a local database? Well there can be many reasons for this, one could be that you would like some real data to test your extensions on and another, which I feel is the most used reason is during upgrades, because it will save you a lot of time, not having to setup all your infrastructure when upgrading. Now some of you might be tempted to think&nbsp;hmm..&nbsp;well if I can connect my database to a Docker, then why not run all my production infrastructure on a Docker, and while this would be possible. Microsoft does not \u201cyet\u201d support this, so I would recommend that you wait, until Microsoft says that it is supported.&nbsp;&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Well&nbsp;let us get started, the first thing you have to do is make sure that your SQL Server is running in mixed mode, this is done by opening your SQL Studio Management going to server properties -&gt; security and choose SQL Server and Windows Authentication mode.&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"242\" src=\"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/Ssms_klkjTvZZYP-1024x242.png\" alt=\"\" class=\"wp-image-270\" srcset=\"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/Ssms_klkjTvZZYP-1024x242.png 1024w, https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/Ssms_klkjTvZZYP-300x71.png 300w, https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/Ssms_klkjTvZZYP-768x181.png 768w, https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/Ssms_klkjTvZZYP.png 1071w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"> This will allow you to connect to the SQL using both Windows and SQL user logins. Next you need to go to connections and make sure that you allow remote connections.&nbsp; <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"690\" height=\"625\" src=\"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/Ssms_fhIe3jfQ2w.png\" alt=\"\" class=\"wp-image-272\" srcset=\"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/Ssms_fhIe3jfQ2w.png 690w, https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/Ssms_fhIe3jfQ2w-300x272.png 300w\" sizes=\"auto, (max-width: 690px) 100vw, 690px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"> Next you need to create a new SQL Login by going to logins and creating a new user and choose SQL Server Authentication, and make the user Sys admin.&nbsp; <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"690\" height=\"625\" src=\"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/Ssms_fAe9yixKTP.png\" alt=\"\" class=\"wp-image-273\" srcset=\"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/Ssms_fAe9yixKTP.png 690w, https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/Ssms_fAe9yixKTP-300x272.png 300w\" sizes=\"auto, (max-width: 690px) 100vw, 690px\" \/><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"690\" height=\"625\" src=\"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/Ssms_wWMw6umldb.png\" alt=\"\" class=\"wp-image-274\" srcset=\"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/Ssms_wWMw6umldb.png 690w, https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/Ssms_wWMw6umldb-300x272.png 300w\" sizes=\"auto, (max-width: 690px) 100vw, 690px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">You should also open port 1433 in your firewall for inbound traffic.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When all this is setup you are ready to create your new container and that is done with the following PowerShell script.&nbsp;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\n$credential = Get-Credential\n$dbcredentials = Get-Credential\n$imageName = &#039;mcr.microsoft.com\/businesscentral\/onprem:14.7.37609.0-dk-ltsc2019&#039;\n$containerName = &#039;MyTest&#039;\n$DatabaseName = &#039;MYBC14&#039;\n$License = &#039;C:\\License\\MyLicense.flf&#039;\n\n\nNew-BCContainer `\n    -accept_eula `\n    -containerName $containerName `\n    -imageName $imageName `\n    -updateHosts `\n    -auth UserPassword `\n    -Credential $credential `\n    -databaseServer &#039;10.100.12.39&#039; `\n    -databaseInstance &#039;&#039; `\n    -databaseName $DatabaseName `\n    -databaseCredential $dbcredentials `\n    -licenseFile $License `\n    -includeAL \n\n\nNew-NavContainerNavUser -containerName $containerName -Credential $credential -ChangePasswordAtNextLogOn:$false -PermissionSetId SUPER\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"> Where you must change the\u00a0-databaseServer\u00a0&#8216;10.100.12.39&#8217; to your own local IP, and that is it this will create a new NAV container running on a local SQL database, enjoy\u00a0&#x1f60a; <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">OBS:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">My kollega&nbsp;<strong>Thomas Guldstrand<\/strong>&nbsp;made me aware that I missed a step which is to<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Remember to enable TCP\/IP in the SQL network configuration.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"331\" src=\"https:\/\/fredborg.org\/wp-content\/uploads\/2021\/03\/image-1024x331.png\" alt=\"\" class=\"wp-image-536\" srcset=\"https:\/\/fredborg.org\/wp-content\/uploads\/2021\/03\/image-1024x331.png 1024w, https:\/\/fredborg.org\/wp-content\/uploads\/2021\/03\/image-300x97.png 300w, https:\/\/fredborg.org\/wp-content\/uploads\/2021\/03\/image-768x249.png 768w, https:\/\/fredborg.org\/wp-content\/uploads\/2021\/03\/image.png 1412w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever wanted to be able to use the easy setup of&nbsp;navcontainerhelper&nbsp;to setup your infrastructure but&nbsp;you would like to&#8230; <a class=\"read-more\" href=\"https:\/\/fredborg.org\/?p=269\" rel=\"nofollow\"> Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":276,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,1],"tags":[],"class_list":["post-269","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-business-central","category-uncategorized","shapla-grid-item"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Connect Local SQL to NAV Container - Fredborg<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fredborg.org\/?p=269\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Connect Local SQL to NAV Container - Fredborg\" \/>\n<meta property=\"og:description\" content=\"Have you ever wanted to be able to use the easy setup of&nbsp;navcontainerhelper&nbsp;to setup your infrastructure but&nbsp;you would like to... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fredborg.org\/?p=269\" \/>\n<meta property=\"og:site_name\" content=\"Fredborg\" \/>\n<meta property=\"article:published_time\" content=\"2020-01-09T07:27:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-03-01T09:35:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/ConnectLocalSQLToDocker.png\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"322\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"dfredborg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dfredborg\" \/>\n<meta name=\"twitter:site\" content=\"@dfredborg\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"dfredborg\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fredborg.org\/?p=269#article\",\"isPartOf\":{\"@id\":\"https:\/\/fredborg.org\/?p=269\"},\"author\":{\"name\":\"dfredborg\",\"@id\":\"https:\/\/fredborg.org\/#\/schema\/person\/59a5520cbf04c6bd1267f30b4488e71d\"},\"headline\":\"Connect Local SQL to NAV Container\",\"datePublished\":\"2020-01-09T07:27:19+00:00\",\"dateModified\":\"2021-03-01T09:35:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fredborg.org\/?p=269\"},\"wordCount\":447,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fredborg.org\/#\/schema\/person\/59a5520cbf04c6bd1267f30b4488e71d\"},\"image\":{\"@id\":\"https:\/\/fredborg.org\/?p=269#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/ConnectLocalSQLToDocker.png\",\"articleSection\":[\"Business Central\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fredborg.org\/?p=269#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fredborg.org\/?p=269\",\"url\":\"https:\/\/fredborg.org\/?p=269\",\"name\":\"Connect Local SQL to NAV Container - Fredborg\",\"isPartOf\":{\"@id\":\"https:\/\/fredborg.org\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fredborg.org\/?p=269#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fredborg.org\/?p=269#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/ConnectLocalSQLToDocker.png\",\"datePublished\":\"2020-01-09T07:27:19+00:00\",\"dateModified\":\"2021-03-01T09:35:35+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fredborg.org\/?p=269#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fredborg.org\/?p=269\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fredborg.org\/?p=269#primaryimage\",\"url\":\"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/ConnectLocalSQLToDocker.png\",\"contentUrl\":\"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/ConnectLocalSQLToDocker.png\",\"width\":600,\"height\":322},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fredborg.org\/?p=269#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fredborg.org\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Connect Local SQL to NAV Container\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fredborg.org\/#website\",\"url\":\"https:\/\/fredborg.org\/\",\"name\":\"Fredborg\",\"description\":\"Business Central and Azure\",\"publisher\":{\"@id\":\"https:\/\/fredborg.org\/#\/schema\/person\/59a5520cbf04c6bd1267f30b4488e71d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fredborg.org\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/fredborg.org\/#\/schema\/person\/59a5520cbf04c6bd1267f30b4488e71d\",\"name\":\"dfredborg\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fredborg.org\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/fredborg.org\/wp-content\/uploads\/2023\/06\/download.png\",\"contentUrl\":\"https:\/\/fredborg.org\/wp-content\/uploads\/2023\/06\/download.png\",\"width\":256,\"height\":256,\"caption\":\"dfredborg\"},\"logo\":{\"@id\":\"https:\/\/fredborg.org\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:fredborg.org\",\"https:\/\/www.linkedin.com\/in\/dfredborg\/\",\"https:\/\/x.com\/dfredborg\",\"https:\/\/www.youtube.com\/channel\/UCUNZglLDMjBlOK_T9JtI8UA\"],\"url\":\"https:\/\/fredborg.org\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Connect Local SQL to NAV Container - Fredborg","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fredborg.org\/?p=269","og_locale":"en_US","og_type":"article","og_title":"Connect Local SQL to NAV Container - Fredborg","og_description":"Have you ever wanted to be able to use the easy setup of&nbsp;navcontainerhelper&nbsp;to setup your infrastructure but&nbsp;you would like to... Read more","og_url":"https:\/\/fredborg.org\/?p=269","og_site_name":"Fredborg","article_published_time":"2020-01-09T07:27:19+00:00","article_modified_time":"2021-03-01T09:35:35+00:00","og_image":[{"width":600,"height":322,"url":"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/ConnectLocalSQLToDocker.png","type":"image\/png"}],"author":"dfredborg","twitter_card":"summary_large_image","twitter_creator":"@dfredborg","twitter_site":"@dfredborg","twitter_misc":{"Written by":"dfredborg","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fredborg.org\/?p=269#article","isPartOf":{"@id":"https:\/\/fredborg.org\/?p=269"},"author":{"name":"dfredborg","@id":"https:\/\/fredborg.org\/#\/schema\/person\/59a5520cbf04c6bd1267f30b4488e71d"},"headline":"Connect Local SQL to NAV Container","datePublished":"2020-01-09T07:27:19+00:00","dateModified":"2021-03-01T09:35:35+00:00","mainEntityOfPage":{"@id":"https:\/\/fredborg.org\/?p=269"},"wordCount":447,"commentCount":0,"publisher":{"@id":"https:\/\/fredborg.org\/#\/schema\/person\/59a5520cbf04c6bd1267f30b4488e71d"},"image":{"@id":"https:\/\/fredborg.org\/?p=269#primaryimage"},"thumbnailUrl":"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/ConnectLocalSQLToDocker.png","articleSection":["Business Central"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fredborg.org\/?p=269#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fredborg.org\/?p=269","url":"https:\/\/fredborg.org\/?p=269","name":"Connect Local SQL to NAV Container - Fredborg","isPartOf":{"@id":"https:\/\/fredborg.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fredborg.org\/?p=269#primaryimage"},"image":{"@id":"https:\/\/fredborg.org\/?p=269#primaryimage"},"thumbnailUrl":"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/ConnectLocalSQLToDocker.png","datePublished":"2020-01-09T07:27:19+00:00","dateModified":"2021-03-01T09:35:35+00:00","breadcrumb":{"@id":"https:\/\/fredborg.org\/?p=269#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fredborg.org\/?p=269"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fredborg.org\/?p=269#primaryimage","url":"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/ConnectLocalSQLToDocker.png","contentUrl":"https:\/\/fredborg.org\/wp-content\/uploads\/2020\/01\/ConnectLocalSQLToDocker.png","width":600,"height":322},{"@type":"BreadcrumbList","@id":"https:\/\/fredborg.org\/?p=269#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fredborg.org\/"},{"@type":"ListItem","position":2,"name":"Connect Local SQL to NAV Container"}]},{"@type":"WebSite","@id":"https:\/\/fredborg.org\/#website","url":"https:\/\/fredborg.org\/","name":"Fredborg","description":"Business Central and Azure","publisher":{"@id":"https:\/\/fredborg.org\/#\/schema\/person\/59a5520cbf04c6bd1267f30b4488e71d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fredborg.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/fredborg.org\/#\/schema\/person\/59a5520cbf04c6bd1267f30b4488e71d","name":"dfredborg","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fredborg.org\/#\/schema\/person\/image\/","url":"https:\/\/fredborg.org\/wp-content\/uploads\/2023\/06\/download.png","contentUrl":"https:\/\/fredborg.org\/wp-content\/uploads\/2023\/06\/download.png","width":256,"height":256,"caption":"dfredborg"},"logo":{"@id":"https:\/\/fredborg.org\/#\/schema\/person\/image\/"},"sameAs":["https:fredborg.org","https:\/\/www.linkedin.com\/in\/dfredborg\/","https:\/\/x.com\/dfredborg","https:\/\/www.youtube.com\/channel\/UCUNZglLDMjBlOK_T9JtI8UA"],"url":"https:\/\/fredborg.org\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/fredborg.org\/index.php?rest_route=\/wp\/v2\/posts\/269","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fredborg.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fredborg.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fredborg.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fredborg.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=269"}],"version-history":[{"count":3,"href":"https:\/\/fredborg.org\/index.php?rest_route=\/wp\/v2\/posts\/269\/revisions"}],"predecessor-version":[{"id":538,"href":"https:\/\/fredborg.org\/index.php?rest_route=\/wp\/v2\/posts\/269\/revisions\/538"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fredborg.org\/index.php?rest_route=\/wp\/v2\/media\/276"}],"wp:attachment":[{"href":"https:\/\/fredborg.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fredborg.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fredborg.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}