Tests/AzureAD/test.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
if ($Credential -eq $null -or $credential -eq [System.Management.Automation.PSCredential]::Empty) {
    $credential = get-credential -UserName $env:USERNAME -Message "Using NavUserPassword Authentication. Please enter your Windows credentials."
}

if ($AadAdminCredential -eq $null -or $AadAdminCredential -eq [System.Management.Automation.PSCredential]::Empty) {
    $AadAdminCredential = Get-Credential
}

$protocol = "http://"
$https = ($protocol -eq "https://")

$containerName = "nav"
Create-AadAppsForNavContainer -AadAdminCredential $AadAdminCredential `
                              -appIdUri "$protocol$containerName/nav/" `
                              -iconPath "c:\temp\nav.png" | Out-Null
New-NavContainer -accept_eula `
                 -containerName $containerName `
                 -Credential $Credential `
                 -authenticationEMail $AadAdminCredential.UserName `
                 -auth aad `
                 -usessl:$https `
                 -imageName "microsoft/dynamics-nav:2018" `
                 -updateHosts `
                 -includeCSide `
                 -additionalParameters @("-e clickonce=Y") `
                 -doNotExportObjectsToText

Create-AadAppsForNavContainer -AadAdminCredential $AadAdminCredential `
                              -appIdUri "$protocol$containerName/nav/webclient/" `
                              -iconPath "c:\temp\nav.png" | Out-Null
New-NavContainer -accept_eula `
                 -containerName $containerName `
                 -Credential $Credential `
                 -authenticationEMail $AadAdminCredential.UserName `
                 -auth aad `
                 -usessl:$https `
                 -imageName "microsoft/dynamics-nav:2017" `
                 -updateHosts `
                 -includeCSide `
                 -additionalParameters @("-e clickonce=Y") `
                 -doNotExportObjectsToText

Create-AadAppsForNavContainer -AadAdminCredential $AadAdminCredential `
                              -appIdUri "$protocol$containerName/nav/webclient/" `
                              -iconPath "c:\temp\nav.png" | Out-Null
New-NavContainer -accept_eula `
                 -containerName $containerName `
                 -Credential $Credential `
                 -authenticationEMail $AadAdminCredential.UserName `
                 -auth aad `
                 -usessl:$https `
                 -imageName "microsoft/dynamics-nav:2016" `
                 -updateHosts `
                 -includeCSide `
                 -additionalParameters @("-e clickonce=Y") `
                 -doNotExportObjectsToText

Remove-NavContainer $containerName -ErrorAction Ignore