How to do it...

  1. In Visual Studio Code, open the televisionShow folder that you extracted from ch9-start.zip and have been working on in the previous recipes of this chapter.
  2. Press Ctrl + Shift + B to build the Television Show application. Take note of the folder location of the application file.
  3. Open the PowerShell ISE and create a new script.
  4. Enter the following code:
$containerName = '<yourContainer>'
$applicationFileFolder = '<yourAppFileFolder>'
$certificatePassword = '<yourCertifictePassword>'
$certificateFile = '<yourCertificateFile>'

Get-ChildItem -Path $applicationFileFolder -Filter '*.app' | ForEach-Object {
$containerAppFile =
"C:ProgramDataNavContainerHelperExtensions
$containerNamemy$($_.Name)"

Copy-Item -Path $_.FullName -Destination $containerAppFile -
Force

Sign-NavContainerApp -appFile $containerAppFile `
-containerName $containerName `
-pfxFile $certificateFile `
-pfxPassword $(ConvertTo-SecureString -String
$certificatePassword -AsPlainText -Force)
}

In the previous code, make sure you populate the correct values for the following variables:

  • containerName: The name of the container that you created as your AL sandbox
  • applicationFileFolder: The folder in which your application file exists (for example, C: emp)
  • certificatePassword: The password for the certificate you are using
  • certificateFile: The full path to the pfx code signing certificate (for example, C: empcertificate.pfx)
This code will copy the original application file to a folder that is shared with the container, and will then sign the application file using the certificate provided. The certificate will automatically be loaded into the container for you, and the signing tool will also be installed in the container automatically.
  1. Save the script as SignAppFile.ps1.
  2. Run the PowerShell script. You should see a message like this when the application has been successfully signed:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.245.1