Showing posts with label Dynamics 365 Business Central. Show all posts
Showing posts with label Dynamics 365 Business Central. Show all posts

Friday, July 24, 2020

Recording Business Central NavContainerHelper benchmarks

By Steve Endow

As I've been using NavContainerHelper, it's become clear that there can be a lot of waiting as it downloads gigabytes of data for the images and hundreds of megabytes for the artifacts.  It then has to mash all of that together to build a Business Central Container.  It can take a while.

Sometimes it seems the process is pretty quick.  But sometimes the process seems to take forever.  When it's in the middle of doing its thing, I can't tell whether it's taking longer than normal, or if it just feels like it's taking a long time.

So I'm now measuring how long it takes for NavContainerHelper to create containers.

Ya gotta measure things

If the container setup process takes longer than normal, I'll want to know why.  Was it a performance issue downloading images or artifacts?  Or is there a performance issue with the VM?  Or did some error cause the script to fail prematurely?


Here's the PowerShell script I've setup to record the start time, end time, and elapsed time of the New-BcContainer process.  This is a sample that uses the values for building a BC container in my environment--you'll want to adjust the New-BcContainer parameter values to your preferred values.


 $StartTime = $(get-date)   
  Try {   
   $output = "Started: " + $StartTime   
   Write-Output $output    
   $containerName = 'bc1'   
   $password = 'P@ssw0rd'   
   $securePassword = ConvertTo-SecureString -String $password -AsPlainText -Force   
   $credential = New-Object pscredential 'admin', $securePassword   
   $auth = 'UserPassword'   
   $artifactUrl = Get-BcArtifactUrl -type 'Sandbox' -version '' -country 'us' -select 'Latest'   
   New-BcContainer `   
    -accept_eula `   
    -containerName $containerName `   
    -credential $credential `   
    -auth $auth `   
    -artifactUrl $artifactUrl `   
    -imageName 'myimage1' `   
    -dns '8.8.8.8' `   
    -updateHosts   
   }   
   Catch {   
    Write-Error "Um, something didn't go well:"   
    Write-Error $_   
   }   
   Finally {   
    $EndTime = $(get-date)   
    $output = "End time: " + $EndTime   
    Write-Output $output    
    $elapsedTime = $(get-date) - $StartTime   
    $totalTime = "{0:HH:mm:ss}" -f ([datetime]$elapsedTime.Ticks)   
    $output = "Elapsed time: " + $totalTime   
    Write-Output $output   
   }   


At the top of the script, I record the start time, then output that time in the log so that I can see when the script started.

I added a try/catch block so that even if the script fails, my script outputs the end time and elapsed time.

In the finally block, I record the time again, then calculate elapsed time.  The elapsed time is then output to the log.

Building a new named image vs. using an existing named image

In this example, I see that when the script had to build a new named image, it took 13 minutes to create the named image and then create the container.  But when it was able to use an existing named image, it only took 1 minute.

Good to know!

Now I can use this script to see how my dedicated physical server compares to my VMs.  I assume that the VMs will be slower, but I'm curious to see how much slower.


Steve Endow is a Microsoft MVP in Los Angeles.  He works with Dynamics 365 Business Central, Microsoft Power Automate, Power Apps, Azure, .NET, Dynamics GP, and SQL Server.

You can also find him on Twitter and YouTube

http://www.precipioservices.com



Automatically Updating NavContainerHelper

By Steve Endow

One of the challenges I've had using the Business Central NavContainerHelper module has been managing the versions and updates.  Freddy Kristiansen is constantly updating NavContainerHelper to add features or fix issues, so a new version might be released within 24 hours of the prior release.

It seems like there is at least one update per week.  As a result, I always forget to update NavContainerHelper and often end up using an older version, which can sometimes result in errors.

I wanted to automate the update process so that I always know that I have the latest version of NavContainerHelper installed.  And ONLY the latest version--making sure that I don't have any older versions installed side-by-side.

I don't know if this is the best method, but I think it should work.  If you know of a better way, let me know!

Here's the script I'd like to run automatically every day:

 $MyModuleName = 'NavContainerHelper'  
 Uninstall-Module $MyModuleName -Force -AllVersions  
 Install-Module $MyModuleName -Force  

The Script

I want to install the latest version, but I want to make sure that I don't have an older version still installed.  There are a few ways to do this, but I figure with this script, it removes all existing versions, and then installs the latest version.

I normally don't recommend Install-Module -Force if you are running the script manually, but in this case, I believe I need -Force in order to bypass the verification dialog that appears during installation.  Also, since I know that I've just uninstalled all versions before installing the latest version, I think using -Force should be okay in this particular case.

I saved the above 3 line script to a .ps1 file.

I then opened Windows Task Scheduler using Run As Administrator.

Windows Task Scheduler
I created a new folder called Steve to make it easier to find my tasks.

I then created a new task (not a Basic task).

Task - General Info

I gave the task a name.  Then I set the task to use the Local Administrator user.  This is on one of my dev VMs, and I know the PowerShell script will need Admin rights, so I chose Administrator just to avoid any hassles.  If you are on a company network / domain, you'll need to figure out which domain user / rights you need to allow the script to run as a task.

Nightly update
On the Triggers tab, I setup a schedule to run Daily at 8pm.

On the Actions tab, I created an action to call powershell with the -File argument, based on this blog post.



The argument I used looks like:

     -File C:\BCPowerShell\UpdateNavContainerHelper_v1.ps1


I then saved the task and tested it. 

It seems to work, so I'll keep an eye on it for a week or so to verify that NavContainerHelper is always on the latest version and that I don't have any old versions installed side-by-side.


Steve Endow is a Microsoft MVP in Los Angeles.  He works with Dynamics 365 Business Central, Microsoft Power Automate, Power Apps, Azure, .NET, Dynamics GP, and SQL Server.

You can also find him on Twitter and YouTube

http://www.precipioservices.com

Wednesday, July 22, 2020

Basic Business Central Docker Commands That I Use

By Steve Endow

On July 1, 2020, I made a video showing the basic Docker commands that I use to manage Business Central Docker Containers.

PowerShell isn't too bad

Here is a complete list of the commands that I've collected to manage Business Central Containers, as of July 2020.  If you have any others that you recommend, please comment below and let me know!


Thanks to Daniel and Tanya and D┼żoka for some additions!


   
 Open Powershell / Powershell ISE on HOST machine using Run As Administrator  
   
 
 NOTE: When referring to a Container ID or Image ID, you can use the first 
       few characters of the ID if they are unique--you do not have to always
       use the full ID.


 Check NavContainerHelper Version  
   
      Get-InstalledModule NavContainerHelper  
   
   
 Fresh Install of NavContainerHelper  
   
      Install-module navcontainerhelper  
      Import-Module navcontainerhelper  
   
   
 Install Latest NavContainerHelper  
   
 If you KNOW you don't have multiple versions installed:  
   
      Update-Module NavContainerHelper -Force  
   
 If you MIGHT have multiple versions installed:  
   
      $MyModuleName = <modulename>  
      Uninstall-Module $MyModuleName -allversions   
      Install-Module $MyModuleName
   
      NOTE: I do not recommend using the -Force option with Install-Module. 
            It can bypass valuable warnings that you want to know about.


 Alternate method to Remove Old Versions of NavContainerHelper  
   
      $ModuleName = 'navcontainerhelper';  
      $Latest = Get-InstalledModule $ModuleName;   
      Get-InstalledModule $ModuleName -AllVersions | ? {$_.Version -ne $Latest.Version} | Uninstall-Module -WhatIf  
   
   
   
 Container Management Commands  
   
      docker ps  
      docker ps -a  
        
      docker start <id>  
      docker stop <id>  
   
      
      docker container inspect 


 Remove Container  
   
    Recommended method:

      Remove-BCContainer <containername>


    Manual Docker method:

      docker stop <id> 
      docker rm <id> 
      Manually clean up hosts file
      Manually remove desktop icons
      Manually remove extensions from C:\ProgramData\NavContainerHelper\Extensions\
   

 Stop all running containers:  
        
      docker stop $(docker ps -aq)  
   
   
 Images  
   
       docker images  
       docker images -a  
   
 Remove Image  
   
      docker rmi <id>  
        
      docker rmi <repository>:<tag>  
   
   Remove all images:

      docker rmi $(docker images -aq)

   
 Clean up old images  
   
   Remove orphaned images with "< none >" identifiers:

      docker images -q -f dangling=true | % { docker rmi $_ }  


   Remove orphaned images:
   
   	  docker image prune -f
      
   Remove orphaned AND UNUSED images:
   
   WARNING: Be careful with this: It will remove generic OS images used by NavContainerHelper!

      docker image prune -a -f
   

   
 Get Artifact Info for an existing BC Container:  
   
      Get-BcContainerArtifactUrl containername  
        
      Get-NavContainerArtifactUrl containername  
   
   
 Diagnostics  
   
      Get-BcContainerEventLog  
   
   
   
 Create New BC Container  
   
      New-BcContainerWizard  
   
   
 https://blog.baudson.de/blog/stop-and-remove-all-docker-containers-and-images  
   




Steve Endow is a Microsoft MVP in Los Angeles.  He works with Dynamics 365 Business Central, Microsoft Power Automate, Power Apps, Azure, .NET, Dynamics GP, and SQL Server.

You can also find him on Twitter and YouTube

http://www.precipioservices.com

Friday, July 10, 2020

The New-BcContainerWizard! And working through Docker errors...

By Steve Endow

Have you used the new New-BcContainerWizard tool?  If not, settle in!  And I'll throw in a story about a puzzling Docker error and how Freddy helped me work through it.

Here's a video where I walk through my recent Docker learning:



Yesterday I planned on working through Erik Hougaard's video about calling an external web API from AL and processing the JSON response.  

Since I needed a new BC Docker Container to work on the demo code, I thought it would be a good opportunity to test Freddy's new BC Container Wizard tool.  So I made sure I had the latest version of NAV Container Helper, and typed New-BcContainerWizard.

The wizard is a really nifty PowerShell utility that asks you a series of questions that walk you through the different options available when using the NewBcContainer command.  After I completed the questions, it provided me with this script.

 $containerName = 'sandbox1'  
 $password = 'P@ssword'  
 $securePassword = ConvertTo-SecureString -String $password -AsPlainText -Force  
 $credential = New-Object pscredential 'admin', $securePassword  
 $auth = 'UserPassword'  
 $artifactUrl = Get-BcArtifactUrl -type 'Sandbox' -version '' -country 'us' -select 'Latest'  
 $licenseFile = 'c:\zdisks\business central\2020-06bcv16license.flf'  
 New-BcContainer `  
   -accept_eula `  
   -containerName $containerName `  
   -credential $credential `  
   -auth $auth `  
   -artifactUrl $artifactUrl `  
   -updateHosts `  
   -assignPremiumPlan `  
   -licenseFile $licenseFile `  
   -dns '192.168.25.21' `  
   -imageName 'mybc16'   
 Setup-BcContainerTestUsers -containerName $containerName -Password $credential.Password -credential $credential  

This is a really great tool.  When I first started using NavContainerHelper, it seemed very confusing and I had no idea which options to include and which values made sense for my needs.  This wizard resolves that and will be a great resource for people who are new to Docker.

Now that I had my nifty PowerShell script, I ran it.  

Sad Trombone
Sad Trombone

"This request is not supported"

Um.  What?

After a bit of googling, I eventually made my way to the NavContainerHelper GitHub repository to see if I could learn anything from the Issues list.  I saw another issue that also had "CreateComputeSystem", but the specific error was different.

So I submitted a separate issue on GitHub.  This was the first GitHub issue I've ever submitted, so I didn't know how or what to include.  I used another issue as an example, and I stumbled through the process, including what I was trying to do, a copy of my New-BcContainer script, and as much information about the error that I had available.

Freddy responded within a few hours asking for the full build log from a successful container build (excluding the imageName parameter).  I was able to attach that full build log as a text file.

Within a few minutes, he replied, explaining that the log showed I was using a very old version of windows.

The last few digits are the important ones

Sure enough, Windows Update had a few failed updates.  Those failed updates had prevented ANY updates from being applied to my server.  Once I cleared those errors and updated my server to the latest windows build, the New-BcContainer script worked successfully with the imageName parameter.

I then looked through the full container build log that I had submitted to the issue, and sure enough, there it was.

I'm talkin' to you!


Among the hundreds of lines that scrolled by during the build process, the warning was right there, showing that I had a very old Windows build and that the generic image didn't match.

While this did delay me by over a day in my AL learning process, this side adventure was very valuable, as it helped me understand a little bit more about Docker and the NavContainerHelper build process.


Wednesday, July 8, 2020

I'm no PowerShell expert: Discovering Update-Module for NavContainerHelper

By Steve Endow

I wrote a post in April, "Make sure to update NavContainerHelper", in which I described some issues I had that were caused by having several old versions of the NavContainerHelper module installed.

Today, while updating the NavContainerHelper module on my Docker VM, I learned a few things, and I think I finally have a basic understanding of the PowerShell Module install and update process.

If you're a PowerShell pro or a NavContainerHelper pro, this will probably seem obvious, but as a newbie with both tools, it was a "learning moment" for me that explained the issues I had previously with multiple NavContainerHelper versions.

Let's start with a screen shot.

Install-Module -Force Warning

Wednesday, July 1, 2020

Business Central Basic Docker Commands

By Steve Endow

If you haven't used Docker before, and if you're not a PowerShell expert, welcome to the club.

I am new to both, and the only reason I'm using Docker and PowerShell is to use Business Central Docker Containers.  I know just enough to do the bare minimum that I need to manage a few Business Central Docker Containers for development and testing.

I have a live stream video demonstrating the commands:

https://www.youtube.com/watch?v=u-mlyIqNl5c





Here are the basic Docker commands that I have been using.


 #Containers  
   
 docker ps  
 docker ps -a  
   
 docker start <id>  
 docker stop <id>  
   
 docker rm <id>  
   
 #Stop all running containers:  
 docker stop $(docker ps -aq)  
   
   
 #Images  
   
 docker images  
 docker images -a  
   
 docker rmi <id>  
   
 docker rmi <repository>:<tag>  
   
   
 #Check NavContainerHelper version  
 Get-InstalledModule  
   
   
 #Install Latest NavContainerHelper  
 $MyModuleName = <modulename>  
 Uninstall-Module $MyModuleName -allversions   
 Install-Module $MyModuleName -Force  





Steve Endow is a Microsoft MVP in Los Angeles.  He works with Dynamics 365 Business Central, Microsoft Power Automate, Power Apps, Azure, .NET, Dynamics GP, and SQL Server.

You can also find him on Twitter and YouTube


New "Learning Business Central" Live Stream Video Series: Two Blind Mice

By Steve Endow

After weeks of research and testing and cameras and microphones and troubleshooting, my friend Tanya Henderson and I launched our new live stream series:  Two Blind Mice: Learning Business Central.

We plan on discussing new features, updates, and sharing our learning journey as we explore Dynamics 365 Business Central.

Here is the first episode:

https://www.youtube.com/watch?v=OyL5BAq68Nw


When we go live, the live stream will be posted on my Twitter account with a link to the Periscope stream.  But you can also watch the live stream on YouTube and Twitch.




If you don't want to watch the live stream, no worries!  You can find the recorded streams on my YouTube and Twitch channels:

https://www.youtube.com/steveendow

https://www.twitch.tv/steveendow





You can also find him on Twitter and YouTube


Monday, June 29, 2020

Live Streaming Business Central Content

By Steve Endow

This morning I did my first solo "live stream". 


     YouTube:  https://youtu.be/J-EmRpHilNs

     Twitch:  https://www.twitch.tv/videos/664954911

     Periscope:  https://twitter.com/steveendow/status/1277607187683045378?s=20


I've participated in a few Power Platform Share live streams hosted by my friend Belinda Allen, but this morning was the first time I've streamed on my own.

Monday, May 18, 2020

Business Central Navigation Challenge: Finding "Hidden" Pages?

By Steve Endow

I'm new to Business Central.  So please excuse my lack of proper Business Central decorum.

I don't yet know the lingo, the tricks, or the secret handshake.  I barely know the basics as I slowly learn the product.

So...I'm like a new "User".  One of those pesky new users who asks the "dumb" questions.  The obvious questions.  The questions that all real Business Central users already know and don't even think about.

Like how to navigate and find pages in Business Central.

Can I just ask for directions?

"Don't navigate! Just use Search!", is the obvious response.

But I, as a typical User, will find the oddities and exceptions.  The apparent secrets of Business Central that are not obvious to a new user.

Saturday, January 25, 2020

Learning Dynamics 365 Business Central Development From Scratch: Introduction

By Steve Endow

If you've never done any NAV or Business Central development, but would like to, join me on this journey to learn how to develop in Dynamics 365 Business Central.

I've never used Dynamics NAV and don't even know what C/AL looks like.  I don't know what a "code unit" is.  Until a few months ago, I had never used Docker.  And although I've used Visual Studio for years, I don't really know how to use VS Code.  I know that Business Central uses a language called "AL", but I can't write a single line of AL.

Based on my experience so far trying to learn the Business Central application and Business Central AL development, I expect this will be a long journey for me.  Because I am still working mostly with Dynamics GP customers and projects in my day job, I have to learn Business Central in my "free time", so it isn't something I'll be able to pick up in just a few months.  A year ago, I gave myself 2 years to be "minimally competent" with the Business Central application and development.  Well, work gets busy and life gets busy, so I think I'm currently well behind on that 2 year timeline, and need to catch up.

Even though I have over 15 years of experience working with Dynamics GP and .NET and SQL Server, Business Central is a completely different world to me.  My fundamental knowledge of ERP software and software development is somewhat helpful as background, but it seems all of the specifics are completely different.  I want to learn Business Central and AL development and have the same comfort level that I have with Dynamics GP and .NET.  That will take time, and will require some pretty intensive learning.

So I'm starting from scratch.  Learning from scratch.  This is the start of that journey.


Monday, April 22, 2019

Dynamics 365 Business Central vs. Dynamics GP: The Home Page

By Steve Endow

First post in this series:  Dynamics 365 Business Central vs. Dynamics GP: Customer Navigation


This post continues my Dynamics 365 Business Central vs. Dynamics GP series, and compares the "Home Pages" of both applications.  If I would have thought of it at the time, I would have made this the first post in the series, but discussing the Home Page didn't occur to me until after my first post.

After I wrote my post about Customer Navigation, I kept wondering why Dynamics 365 Business Central looks and feels so different than Dynamics GP.  After I wrote the post, I realized that the Customer Navigation in Business Central is pretty simple and pretty obvious.  So why do I feel so disoriented when I login to Business Central?

After actually staring at the Business Central Home Page for a while, I realized that the Home Page probably has something to do with my disorientation.  The Dynamics 365 Business Central Home Page is a very different experience for a long time Dynamics GP user.  As someone who has seen the Dynamics GP application daily for the last 15 years, the Business Central Home Page is actually visually disorienting for me.  When it appears, I literally don't know where to look or what to do.

In this post, I compare the Dynamics GP Home Page to the Business Central Home Page and share my opinions as a brand new Business Central user.


Friday, April 19, 2019

Dynamics 365 Business Central vs. Dynamics GP: Customer Navigation

By Steve Endow

I've been working with Dynamics GP for 15 years, and as a result, I know it so well that I can navigate the application without even thinking.  I know the menus, navigation, windows, fields, and dialog boxes so well that I can tab and click through the data entry process as easily as I can touch type.  I know exactly where to find settings and options and transactions and specific fields.  It's like second nature to me.

On the other hand, I am completely new to Dynamics 365 Business Central. I've been playing with it since it was Project Madeira and then Business Essentials, and now, finally, Business Central. But I have not spent much time working with it yet.

When I launch Business Central, everything feels foreign.  The UI is web based, and the navigation is designed completely differently than Dynamics GP.  I currently feel a bit lost when working with the application.  Fundamentally, Business Central has similar functionality as Dynamics GP, but it's a completely different user experience.

As an alternative to going through all of the Business Central online courses, I am interested in using my knowledge of Dynamics GP as a reference point to compare the features and functionality of Business Central to Dynamics GP.  How is Business Central navigation different from GP?  How are the record types different?  How are the fields and options different?  What can BC do that GP cannot, and vice versa?

Using this approach also makes it easier for me to review Business Central in bite-sized chunks.  One record or window at a time.

This is the start of that journey.

NOTE: Obviously I am not yet an expert in Dynamics 365 Business Central.  If I have missed any important points or have shared any incorrect information about Business Central, please let me know. I welcome any feedback or suggestions.  You can post a comment at the bottom of this post, or email me at steveendow (at) gmail.


Monday, April 1, 2019

Microsoft Dynamics 365 Business Central: Links to Information and Resources

By Steve Endow

Last updated 24 July 2020     (174 resources)



There is so much information being published about Dynamics 365 Business Central that it's difficult to keep track of everything.  I am collecting links to information and resources here for my reference.  I will update this list regularly as I find new resources.

You can use this short URL to reference this post:  http://bit.ly/bcresources

Please feel free to send me additional resources!

I can be reached via DM on Twitter at https://twitter.com/steveendow  or via email at:  steveendow {at} gmail.


Thursday, March 28, 2019

Dynamics 365 Business Central April Upgrade Scheduling - Important Notes!

By Steve Endow

If you haven't read the post on the Business Central for Partners blog about "Scheduling your April 2019 Upgrade for Business Central", I recommend reading it thoroughly.

https://community.dynamics.com/business/b/businesscentraldevitpro/archive/2019/03/27/scheduling-your-spring-2019-upgrade-for-business-central


It has several very valuable points about enhancements to the Business Central version upgrade process.


Some of the key points are:

Beginning with the April '19 release, we will also send notifications for preview version availability, upgrade scheduling, extension validation, and upgrade failures.

Fully automate the Business Central Container build process

By Steve Endow I don't like maintenance tasks.  I don't like having to remember to do something on a regular basis.  I don't l...