From 1f3a85d256386e8f847705b06d9500d5c8a31c12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=B6tz=20Jensen?= Date: Sun, 3 Mar 2024 15:13:11 +0100 Subject: [PATCH] Feature: Implement the Set-BapEnvironmentVirtualEntity cmdlet --- d365bap.tools/d365bap.tools.psd1 | 2 + .../Compare-BapEnvironmentD365App.ps1 | 2 +- .../functions/Compare-BapEnvironmentUser.ps1 | 2 +- .../functions/Get-BapEnvironment.ps1 | 3 +- .../functions/Get-BapEnvironmentD365App.ps1 | 2 +- .../Get-BapEnvironmentVirtualEntity.ps1 | 14 +- .../Invoke-BapEnvironmentInstallD365App.ps1 | 2 +- .../Set-BapEnvironmentVirtualEntity.ps1 | 217 ++++++++++++++++++ .../Set-BapEnvironmentVirtualEntity.Tests.ps1 | 101 ++++++++ docs/Compare-BapEnvironmentD365App.md | 2 +- docs/Compare-BapEnvironmentUser.md | 2 +- docs/Get-BapEnvironment.md | 2 +- docs/Get-BapEnvironmentD365App.md | 2 +- docs/Get-BapEnvironmentVirtualEntity.md | 17 +- docs/Invoke-BapEnvironmentInstallD365App.md | 2 +- docs/Set-BapEnvironmentVirtualEntity.md | 175 ++++++++++++++ 16 files changed, 533 insertions(+), 14 deletions(-) create mode 100644 d365bap.tools/functions/Set-BapEnvironmentVirtualEntity.ps1 create mode 100644 d365bap.tools/tests/functions/Set-BapEnvironmentVirtualEntity.Tests.ps1 create mode 100644 docs/Set-BapEnvironmentVirtualEntity.md diff --git a/d365bap.tools/d365bap.tools.psd1 b/d365bap.tools/d365bap.tools.psd1 index ae9f86b..71a2451 100644 --- a/d365bap.tools/d365bap.tools.psd1 +++ b/d365bap.tools/d365bap.tools.psd1 @@ -57,6 +57,8 @@ , 'Get-BapEnvironmentVirtualEntity' , 'Invoke-BapEnvironmentInstallD365App' + + , 'Set-BapEnvironmentVirtualEntity' ) # Cmdlets to export from this module diff --git a/d365bap.tools/functions/Compare-BapEnvironmentD365App.ps1 b/d365bap.tools/functions/Compare-BapEnvironmentD365App.ps1 index e0e88ac..3dc334d 100644 --- a/d365bap.tools/functions/Compare-BapEnvironmentD365App.ps1 +++ b/d365bap.tools/functions/Compare-BapEnvironmentD365App.ps1 @@ -4,7 +4,7 @@ Compare environment D365 Apps .DESCRIPTION - This enables the user to compare 2 x environments, with one as a source and the other as a destination + Enables the user to compare 2 x environments, with one as a source and the other as a destination It will only look for installed D365 Apps on the source, and use this as a baseline against the destination diff --git a/d365bap.tools/functions/Compare-BapEnvironmentUser.ps1 b/d365bap.tools/functions/Compare-BapEnvironmentUser.ps1 index cbe08e0..55c0a52 100644 --- a/d365bap.tools/functions/Compare-BapEnvironmentUser.ps1 +++ b/d365bap.tools/functions/Compare-BapEnvironmentUser.ps1 @@ -4,7 +4,7 @@ Compare the environment users .DESCRIPTION - This enables the user to compare 2 x environments, with one as a source and the other as a destination + Enables the user to compare 2 x environments, with one as a source and the other as a destination It will only look for users on the source, and use this as a baseline against the destination diff --git a/d365bap.tools/functions/Get-BapEnvironment.ps1 b/d365bap.tools/functions/Get-BapEnvironment.ps1 index c3ace85..4ddaece 100644 --- a/d365bap.tools/functions/Get-BapEnvironment.ps1 +++ b/d365bap.tools/functions/Get-BapEnvironment.ps1 @@ -4,7 +4,7 @@ Get environment info .DESCRIPTION - This enables the user to query and validate all environments that are available from inside PPAC + Enables the user to query and validate all environments that are available from inside PPAC It utilizes the "https://api.bap.microsoft.com" REST API @@ -103,6 +103,7 @@ function Get-BapEnvironment { @{Name = "LinkedMetaPpacOrgId"; Expression = { $envObj.Properties.linkedEnvironmentMetadata.resourceId } }, @{Name = "LinkedMetaPpacUniqueId"; Expression = { $envObj.Properties.linkedEnvironmentMetadata.uniqueName } }, @{Name = "LinkedMetaPpacEnvUri"; Expression = { $envObj.Properties.linkedEnvironmentMetadata.instanceUrl -replace "com/", "com" } }, + @{Name = "LinkedMetaPpacEnvApiUri"; Expression = { $envObj.Properties.linkedEnvironmentMetadata.instanceApiUrl -replace "com/", "com" } }, @{Name = "LinkedMetaPpacEnvLanguage"; Expression = { $envObj.Properties.linkedEnvironmentMetadata.baseLanguage } }, @{Name = "PpacClusterIsland"; Expression = { $envObj.Properties.cluster.uriSuffix } }, "*" diff --git a/d365bap.tools/functions/Get-BapEnvironmentD365App.ps1 b/d365bap.tools/functions/Get-BapEnvironmentD365App.ps1 index 26bb77f..b7e26ad 100644 --- a/d365bap.tools/functions/Get-BapEnvironmentD365App.ps1 +++ b/d365bap.tools/functions/Get-BapEnvironmentD365App.ps1 @@ -4,7 +4,7 @@ Get D365 App from the environment .DESCRIPTION - This enables the user to analyze and validate the current D365 Apps and their state, on a given environment + Enables the user to analyze and validate the current D365 Apps and their state, on a given environment It can show all available D365 Apps - including their InstallState diff --git a/d365bap.tools/functions/Get-BapEnvironmentVirtualEntity.ps1 b/d365bap.tools/functions/Get-BapEnvironmentVirtualEntity.ps1 index ba64fef..da1486b 100644 --- a/d365bap.tools/functions/Get-BapEnvironmentVirtualEntity.ps1 +++ b/d365bap.tools/functions/Get-BapEnvironmentVirtualEntity.ps1 @@ -1,12 +1,12 @@  <# .SYNOPSIS - Get Virutal Entity + Get Virtual Entity from environment .DESCRIPTION Enables the user to query against the Virtual Entities from the D365FO environment - This will help determine which Virtual Entities are already enabled / visible and their state + This will help determine which Virtual Entities are already enabled / visible and their state, as they are seeing from the Dataverse environment .PARAMETER EnvironmentId The id of the environment that you want to work against @@ -80,6 +80,16 @@ DimAttributeRetailTerminalEnt… False False 00002893-0000-0000-6e07-005001000000 EcoResRetailProductEntity False False 00002893-0000-0000-ae06-005001000000 + .EXAMPLE + PS C:\> Get-BapEnvironmentVirtualEntity -EnvironmentId eec2c11a-a4c7-4e1d-b8ed-f62acc9c74c6 -Name AccountantEntity + + This will fetch the specific virtual entity from the environment. + + Sample output: + EntityName IsVisible ChangeTrackingEnabled EntityGuid + ---------- --------- --------------------- ---------- + AccountantEntity False False 00002893-0000-0000-0003-005001000000 + .NOTES Author: Mötz Jensen (@Splaxi) #> diff --git a/d365bap.tools/functions/Invoke-BapEnvironmentInstallD365App.ps1 b/d365bap.tools/functions/Invoke-BapEnvironmentInstallD365App.ps1 index 159051f..3e63a57 100644 --- a/d365bap.tools/functions/Invoke-BapEnvironmentInstallD365App.ps1 +++ b/d365bap.tools/functions/Invoke-BapEnvironmentInstallD365App.ps1 @@ -4,7 +4,7 @@ Invoke the installation of a D365 App in a given environment .DESCRIPTION - This enables the invocation of the installation process against the PowerPlatform API (https://api.powerplatform.com) + Enables the invocation of the installation process against the PowerPlatform API (https://api.powerplatform.com) The cmdlet will keep requesting the status of all invoked installations, until they all have a NON "Running" state diff --git a/d365bap.tools/functions/Set-BapEnvironmentVirtualEntity.ps1 b/d365bap.tools/functions/Set-BapEnvironmentVirtualEntity.ps1 new file mode 100644 index 0000000..46ac731 --- /dev/null +++ b/d365bap.tools/functions/Set-BapEnvironmentVirtualEntity.ps1 @@ -0,0 +1,217 @@ + +<# + .SYNOPSIS + Set Virtual Entity configuration in environment + + .DESCRIPTION + Enables the user to update the configuration for any given Virtual Entity in the environment + + The configuration is done against the Dataverse environment, and allows the user to update the Visibility or TrackingChanges, for a given Virtual Entity + + .PARAMETER EnvironmentId + The id of the environment that you want to work against + + .PARAMETER Name + The name of the virtual entity that you are looking for + + .PARAMETER VisibilityOn + Instructs the cmdlet to turn "ON" the Virtual Entity + + Can be used in combination with TrackingOn / TrackingOff + + .PARAMETER VisibilityOff + Instructs the cmdlet to turn "OFF" the Virtual Entity + + Can be used in combination with TrackingOn / TrackingOff + + .PARAMETER TrackingOn + Instructs the cmdlet to enable ChangeTracking on the Virtual Entity + + Can be used in combination with VisibilityOn / VisibilityOff + + .PARAMETER TrackingOff + Instructs the cmdlet to disable ChangeTracking on the Virtual Entity + + Can be used in combination with VisibilityOn / VisibilityOff + + .EXAMPLE + PS C:\> Set-BapEnvironmentVirtualEntity -EnvironmentId eec2c11a-a4c7-4e1d-b8ed-f62acc9c74c6 -Name AccountantEntity -VisibilityOn -TrackingOff + + This will enable the Virtual Entity "AccountantEntity" on the environment. + It will turn off the ChangeTracking at the same time. + + Sample output: + EntityName IsVisible ChangeTrackingEnabled EntityGuid + ---------- --------- --------------------- ---------- + AccountantEntity True False 00002893-0000-0000-0003-005001000000 + + .EXAMPLE + PS C:\> Set-BapEnvironmentVirtualEntity -EnvironmentId eec2c11a-a4c7-4e1d-b8ed-f62acc9c74c6 -Name AccountantEntity -VisibilityOff + + This will disable the Virtual Entity "AccountantEntity" on the environment. + + Sample output: + EntityName IsVisible ChangeTrackingEnabled EntityGuid + ---------- --------- --------------------- ---------- + AccountantEntity False False 00002893-0000-0000-0003-005001000000 + + .EXAMPLE + PS C:\> Set-BapEnvironmentVirtualEntity -EnvironmentId eec2c11a-a4c7-4e1d-b8ed-f62acc9c74c6 -Name AccountantEntity -TrackingOn + + This will update the Virtual Entity "AccountantEntity" on the environment. + It will enable the ChangeTracking for the entity. + + Sample output: + EntityName IsVisible ChangeTrackingEnabled EntityGuid + ---------- --------- --------------------- ---------- + AccountantEntity True True 00002893-0000-0000-0003-005001000000 + + .NOTES + Author: Mötz Jensen (@Splaxi) +#> +function Set-BapEnvironmentVirtualEntity { + [CmdletBinding()] + param ( + [parameter (mandatory = $true)] + [string] $EnvironmentId, + + [parameter (mandatory = $true)] + [string] $Name, + + [switch] $VisibilityOn, + + [switch] $VisibilityOff, + + [switch] $TrackingOn, + + [switch] $TrackingOff + ) + + begin { + if (-not($VisibilityOn -or $VisibilityOff -or $TrackingOn -or $TrackingOff)) { + $messageString = "You need to select atleast one of the ParameterSets: You have to use either -VisibilityOn / -VisibilityOff or -TrackingOn / -TrackingOff." + Write-PSFMessage -Level Host -Message $messageString + Stop-PSFFunction -Message "Stopping because intent of the operation is NOT clear." -Exception $([System.Exception]::new($($messageString -replace '<[^>]+>', ''))) + } + + if ($VisibilityOn -and $VisibilityOff) { + $messageString = "The supplied parameter combination is not valid. You have to use either -VisibilityOn or -VisibilityOff." + Write-PSFMessage -Level Host -Message $messageString + Stop-PSFFunction -Message "Stopping because intent of the operation is NOT clear." -Exception $([System.Exception]::new($($messageString -replace '<[^>]+>', ''))) + } + + if ($TrackingOn -and $TrackingOff) { + $messageString = "The supplied parameter combination is not valid. You have to use either -TrackingOn or -TrackingOff." + Write-PSFMessage -Level Host -Message $messageString + Stop-PSFFunction -Message "Stopping because intent of the operation is NOT clear." -Exception $([System.Exception]::new($($messageString -replace '<[^>]+>', ''))) + } + + if (Test-PSFFunctionInterrupt) { return } + + # Make sure all *BapEnvironment* cmdlets will validate that the environment exists prior running anything. + $envObj = Get-BapEnvironment -EnvironmentId $EnvironmentId | Select-Object -First 1 + + if ($null -eq $envObj) { + $messageString = "The supplied EnvironmentId: $EnvironmentId didn't return any matching environment details. Please verify that the EnvironmentId is correct - try running the Get-BapEnvironment cmdlet." + Write-PSFMessage -Level Host -Message $messageString + Stop-PSFFunction -Message "Stopping because environment was NOT found based on the id." -Exception $([System.Exception]::new($($messageString -replace '<[^>]+>', ''))) + } + + if (Test-PSFFunctionInterrupt) { return } + + $baseUri = $envObj.LinkedMetaPpacEnvApiUri + $tokenWebApi = Get-AzAccessToken -ResourceUrl $baseUri + $headersWebApi = @{ + "Authorization" = "Bearer $($tokenWebApi.Token)" + } + + $entities = @(Get-BapEnvironmentVirtualEntity -EnvironmentId $EnvironmentId -Name $Name) + + if ($entities.Count -ne 1) { + $messageString = "The supplied EnvironmentId: $EnvironmentId didn't return any matching environment details. Please verify that the EnvironmentId is correct - try running the Get-BapEnvironment cmdlet." + Write-PSFMessage -Level Host -Message $messageString + Stop-PSFFunction -Message "Stopping because environment was NOT found based on the id." -Exception $([System.Exception]::new($($messageString -replace '<[^>]+>', ''))) + } + + if (Test-PSFFunctionInterrupt) { return } + + $entity = $entities[0] + } + + process { + if (Test-PSFFunctionInterrupt) { return } + + $localUri = $($baseUri + '/XRMServices/2011/Organization.svc/web?SDKClientVersion=9.2.49.3165' -f $entity.EntityGuid) + $tempObj = [ordered]@{} + + # Base payload for updating the virtual entity configuration + $body = @' + + + CrmUser + 9.2.49.3165 + {0} + + + + + + + Target + + +##INPUT## + + + + {1} + + mserp_financeandoperationsentity + + + + + + {0} + Update + + + + +'@ -f $([System.Guid]::NewGuid().Guid), $entity.EntityGuid + + + if ($VisibilityOn -or $VisibilityOff) { + # We need to set the Visibility configuration for the virtual entity + $visibility = @' + + mserp_hasbeengenerated + {0} + +'@ -f $(if ($VisibilityOn) { "true" }else { "false" }) + } + + + if ($TrackingOn -or $TrackingOff) { + # We need to set the Tracking configuration for the virtual entity + $tracking = @' + + mserp_changetrackingenabled + {0} + +'@ -f $(if ($TrackingOn) { "true" }else { "false" }) + } + + $body = $body -replace $("##INPUT##", "$visibility`r`n$tracking") + + $headersWebApi."Content-Type" = "text/xml; charset=utf-8" + $headersWebApi.SOAPAction = "http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute" + Invoke-RestMethod -Method Post -Uri $localUri -Headers $headersWebApi -Body $body -ContentType "text/xml; charset=utf-8" > $null + + Get-BapEnvironmentVirtualEntity -EnvironmentId $EnvironmentId -Name $Name + } + + end { + + } +} \ No newline at end of file diff --git a/d365bap.tools/tests/functions/Set-BapEnvironmentVirtualEntity.Tests.ps1 b/d365bap.tools/tests/functions/Set-BapEnvironmentVirtualEntity.Tests.ps1 new file mode 100644 index 0000000..1506ec6 --- /dev/null +++ b/d365bap.tools/tests/functions/Set-BapEnvironmentVirtualEntity.Tests.ps1 @@ -0,0 +1,101 @@ +Describe "Set-BapEnvironmentVirtualEntity Unit Tests" -Tag "Unit" { + BeforeAll { + # Place here all things needed to prepare for the tests + } + AfterAll { + # Here is where all the cleanup tasks go + } + + Describe "Ensuring unchanged command signature" { + It "should have the expected parameter sets" { + (Get-Command Set-BapEnvironmentVirtualEntity).ParameterSets.Name | Should -Be '__AllParameterSets' + } + + It 'Should have the expected parameter EnvironmentId' { + $parameter = (Get-Command Set-BapEnvironmentVirtualEntity).Parameters['EnvironmentId'] + $parameter.Name | Should -Be 'EnvironmentId' + $parameter.ParameterType.ToString() | Should -Be System.String + $parameter.IsDynamic | Should -Be $False + $parameter.ParameterSets.Keys | Should -Be '__AllParameterSets' + $parameter.ParameterSets.Keys | Should -Contain '__AllParameterSets' + $parameter.ParameterSets['__AllParameterSets'].IsMandatory | Should -Be $True + $parameter.ParameterSets['__AllParameterSets'].Position | Should -Be 0 + $parameter.ParameterSets['__AllParameterSets'].ValueFromPipeline | Should -Be $False + $parameter.ParameterSets['__AllParameterSets'].ValueFromPipelineByPropertyName | Should -Be $False + $parameter.ParameterSets['__AllParameterSets'].ValueFromRemainingArguments | Should -Be $False + } + It 'Should have the expected parameter Name' { + $parameter = (Get-Command Set-BapEnvironmentVirtualEntity).Parameters['Name'] + $parameter.Name | Should -Be 'Name' + $parameter.ParameterType.ToString() | Should -Be System.String + $parameter.IsDynamic | Should -Be $False + $parameter.ParameterSets.Keys | Should -Be '__AllParameterSets' + $parameter.ParameterSets.Keys | Should -Contain '__AllParameterSets' + $parameter.ParameterSets['__AllParameterSets'].IsMandatory | Should -Be $True + $parameter.ParameterSets['__AllParameterSets'].Position | Should -Be 1 + $parameter.ParameterSets['__AllParameterSets'].ValueFromPipeline | Should -Be $False + $parameter.ParameterSets['__AllParameterSets'].ValueFromPipelineByPropertyName | Should -Be $False + $parameter.ParameterSets['__AllParameterSets'].ValueFromRemainingArguments | Should -Be $False + } + It 'Should have the expected parameter VisibilityOn' { + $parameter = (Get-Command Set-BapEnvironmentVirtualEntity).Parameters['VisibilityOn'] + $parameter.Name | Should -Be 'VisibilityOn' + $parameter.ParameterType.ToString() | Should -Be System.Management.Automation.SwitchParameter + $parameter.IsDynamic | Should -Be $False + $parameter.ParameterSets.Keys | Should -Be '__AllParameterSets' + $parameter.ParameterSets.Keys | Should -Contain '__AllParameterSets' + $parameter.ParameterSets['__AllParameterSets'].IsMandatory | Should -Be $False + $parameter.ParameterSets['__AllParameterSets'].Position | Should -Be -2147483648 + $parameter.ParameterSets['__AllParameterSets'].ValueFromPipeline | Should -Be $False + $parameter.ParameterSets['__AllParameterSets'].ValueFromPipelineByPropertyName | Should -Be $False + $parameter.ParameterSets['__AllParameterSets'].ValueFromRemainingArguments | Should -Be $False + } + It 'Should have the expected parameter VisibilityOff' { + $parameter = (Get-Command Set-BapEnvironmentVirtualEntity).Parameters['VisibilityOff'] + $parameter.Name | Should -Be 'VisibilityOff' + $parameter.ParameterType.ToString() | Should -Be System.Management.Automation.SwitchParameter + $parameter.IsDynamic | Should -Be $False + $parameter.ParameterSets.Keys | Should -Be '__AllParameterSets' + $parameter.ParameterSets.Keys | Should -Contain '__AllParameterSets' + $parameter.ParameterSets['__AllParameterSets'].IsMandatory | Should -Be $False + $parameter.ParameterSets['__AllParameterSets'].Position | Should -Be -2147483648 + $parameter.ParameterSets['__AllParameterSets'].ValueFromPipeline | Should -Be $False + $parameter.ParameterSets['__AllParameterSets'].ValueFromPipelineByPropertyName | Should -Be $False + $parameter.ParameterSets['__AllParameterSets'].ValueFromRemainingArguments | Should -Be $False + } + It 'Should have the expected parameter TrackingOn' { + $parameter = (Get-Command Set-BapEnvironmentVirtualEntity).Parameters['TrackingOn'] + $parameter.Name | Should -Be 'TrackingOn' + $parameter.ParameterType.ToString() | Should -Be System.Management.Automation.SwitchParameter + $parameter.IsDynamic | Should -Be $False + $parameter.ParameterSets.Keys | Should -Be '__AllParameterSets' + $parameter.ParameterSets.Keys | Should -Contain '__AllParameterSets' + $parameter.ParameterSets['__AllParameterSets'].IsMandatory | Should -Be $False + $parameter.ParameterSets['__AllParameterSets'].Position | Should -Be -2147483648 + $parameter.ParameterSets['__AllParameterSets'].ValueFromPipeline | Should -Be $False + $parameter.ParameterSets['__AllParameterSets'].ValueFromPipelineByPropertyName | Should -Be $False + $parameter.ParameterSets['__AllParameterSets'].ValueFromRemainingArguments | Should -Be $False + } + It 'Should have the expected parameter TrackingOff' { + $parameter = (Get-Command Set-BapEnvironmentVirtualEntity).Parameters['TrackingOff'] + $parameter.Name | Should -Be 'TrackingOff' + $parameter.ParameterType.ToString() | Should -Be System.Management.Automation.SwitchParameter + $parameter.IsDynamic | Should -Be $False + $parameter.ParameterSets.Keys | Should -Be '__AllParameterSets' + $parameter.ParameterSets.Keys | Should -Contain '__AllParameterSets' + $parameter.ParameterSets['__AllParameterSets'].IsMandatory | Should -Be $False + $parameter.ParameterSets['__AllParameterSets'].Position | Should -Be -2147483648 + $parameter.ParameterSets['__AllParameterSets'].ValueFromPipeline | Should -Be $False + $parameter.ParameterSets['__AllParameterSets'].ValueFromPipelineByPropertyName | Should -Be $False + $parameter.ParameterSets['__AllParameterSets'].ValueFromRemainingArguments | Should -Be $False + } + } + + Describe "Testing parameterset __AllParameterSets" { + <# + __AllParameterSets -EnvironmentId -Name + __AllParameterSets -EnvironmentId -Name -VisibilityOn -VisibilityOff -TrackingOn -TrackingOff + #> + } + +} \ No newline at end of file diff --git a/docs/Compare-BapEnvironmentD365App.md b/docs/Compare-BapEnvironmentD365App.md index 19a7e2d..9d1a25d 100644 --- a/docs/Compare-BapEnvironmentD365App.md +++ b/docs/Compare-BapEnvironmentD365App.md @@ -18,7 +18,7 @@ Compare-BapEnvironmentD365App [-SourceEnvironmentId] [-DestinationEnvir ``` ## DESCRIPTION -This enables the user to compare 2 x environments, with one as a source and the other as a destination +Enables the user to compare 2 x environments, with one as a source and the other as a destination It will only look for installed D365 Apps on the source, and use this as a baseline against the destination diff --git a/docs/Compare-BapEnvironmentUser.md b/docs/Compare-BapEnvironmentUser.md index 69e094e..a4dd44e 100644 --- a/docs/Compare-BapEnvironmentUser.md +++ b/docs/Compare-BapEnvironmentUser.md @@ -18,7 +18,7 @@ Compare-BapEnvironmentUser [-SourceEnvironmentId] [-DestinationEnvironm ``` ## DESCRIPTION -This enables the user to compare 2 x environments, with one as a source and the other as a destination +Enables the user to compare 2 x environments, with one as a source and the other as a destination It will only look for users on the source, and use this as a baseline against the destination diff --git a/docs/Get-BapEnvironment.md b/docs/Get-BapEnvironment.md index f9378e3..8e4ee3e 100644 --- a/docs/Get-BapEnvironment.md +++ b/docs/Get-BapEnvironment.md @@ -17,7 +17,7 @@ Get-BapEnvironment [[-EnvironmentId] ] [-AsExcelOutput] [ [[-Name] ] [[-Instal ``` ## DESCRIPTION -This enables the user to analyze and validate the current D365 Apps and their state, on a given environment +Enables the user to analyze and validate the current D365 Apps and their state, on a given environment It can show all available D365 Apps - including their InstallState diff --git a/docs/Get-BapEnvironmentVirtualEntity.md b/docs/Get-BapEnvironmentVirtualEntity.md index 5024e1b..8f80b77 100644 --- a/docs/Get-BapEnvironmentVirtualEntity.md +++ b/docs/Get-BapEnvironmentVirtualEntity.md @@ -8,7 +8,7 @@ schema: 2.0.0 # Get-BapEnvironmentVirtualEntity ## SYNOPSIS -Get Virutal Entity +Get Virtual Entity from environment ## SYNTAX @@ -20,7 +20,7 @@ Get-BapEnvironmentVirtualEntity [-EnvironmentId] [[-Name] ] [-V ## DESCRIPTION Enables the user to query against the Virtual Entities from the D365FO environment -This will help determine which Virtual Entities are already enabled / visible and their state +This will help determine which Virtual Entities are already enabled / visible and their state, as they are seeing from the Dataverse environment ## EXAMPLES @@ -77,6 +77,18 @@ DimAttributeRetailStoreEntity False False 00002893-0000-000 DimAttributeRetailTerminalEnt… False False 00002893-0000-0000-6e07-005001000000 EcoResRetailProductEntity False False 00002893-0000-0000-ae06-005001000000 +### EXAMPLE 5 +``` +Get-BapEnvironmentVirtualEntity -EnvironmentId eec2c11a-a4c7-4e1d-b8ed-f62acc9c74c6 -Name AccountantEntity +``` + +This will fetch the specific virtual entity from the environment. + +Sample output: +EntityName IsVisible ChangeTrackingEnabled EntityGuid +---------- --------- --------------------- ---------- +AccountantEntity False False 00002893-0000-0000-0003-005001000000 + ## PARAMETERS ### -EnvironmentId @@ -167,6 +179,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS +### System.Object[] ## NOTES Author: Mötz Jensen (@Splaxi) diff --git a/docs/Invoke-BapEnvironmentInstallD365App.md b/docs/Invoke-BapEnvironmentInstallD365App.md index d159818..a81f781 100644 --- a/docs/Invoke-BapEnvironmentInstallD365App.md +++ b/docs/Invoke-BapEnvironmentInstallD365App.md @@ -17,7 +17,7 @@ Invoke-BapEnvironmentInstallD365App [-EnvironmentId] [-PackageId] [-Name] [-VisibilityOn] [-VisibilityOff] + [-TrackingOn] [-TrackingOff] [] +``` + +## DESCRIPTION +Enables the user to update the configuration for any given Virtual Entity in the environment + +The configuration is done against the Dataverse environment, and allows the user to update the Visibility or TrackingChanges, for a given Virtual Entity + +## EXAMPLES + +### EXAMPLE 1 +``` +Set-BapEnvironmentVirtualEntity -EnvironmentId eec2c11a-a4c7-4e1d-b8ed-f62acc9c74c6 -Name AccountantEntity -VisibilityOn -TrackingOff +``` + +This will enable the Virtual Entity "AccountantEntity" on the environment. +It will turn off the ChangeTracking at the same time. + +Sample output: +EntityName IsVisible ChangeTrackingEnabled EntityGuid +---------- --------- --------------------- ---------- +AccountantEntity True False 00002893-0000-0000-0003-005001000000 + +### EXAMPLE 2 +``` +Set-BapEnvironmentVirtualEntity -EnvironmentId eec2c11a-a4c7-4e1d-b8ed-f62acc9c74c6 -Name AccountantEntity -VisibilityOff +``` + +This will disable the Virtual Entity "AccountantEntity" on the environment. + +Sample output: +EntityName IsVisible ChangeTrackingEnabled EntityGuid +---------- --------- --------------------- ---------- +AccountantEntity False False 00002893-0000-0000-0003-005001000000 + +### EXAMPLE 3 +``` +Set-BapEnvironmentVirtualEntity -EnvironmentId eec2c11a-a4c7-4e1d-b8ed-f62acc9c74c6 -Name AccountantEntity -TrackingOn +``` + +This will update the Virtual Entity "AccountantEntity" on the environment. +It will enable the ChangeTracking for the entity. + +Sample output: +EntityName IsVisible ChangeTrackingEnabled EntityGuid +---------- --------- --------------------- ---------- +AccountantEntity True True 00002893-0000-0000-0003-005001000000 + +## PARAMETERS + +### -EnvironmentId +The id of the environment that you want to work against + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name of the virtual entity that you are looking for + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VisibilityOn +Instructs the cmdlet to turn "ON" the Virtual Entity + +Can be used in combination with TrackingOn / TrackingOff + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VisibilityOff +Instructs the cmdlet to turn "OFF" the Virtual Entity + +Can be used in combination with TrackingOn / TrackingOff + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TrackingOn +Instructs the cmdlet to enable ChangeTracking on the Virtual Entity + +Can be used in combination with VisibilityOn / VisibilityOff + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TrackingOff +Instructs the cmdlet to disable ChangeTracking on the Virtual Entity + +Can be used in combination with VisibilityOn / VisibilityOff + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: False +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +## NOTES +Author: Mötz Jensen (@Splaxi) + +## RELATED LINKS