This commit is contained in:
Mikael Karlsson
2021-09-23 18:12:33 +10:00
parent 58abeeb9bd
commit b852e9163c
3 changed files with 97 additions and 24 deletions

View File

@@ -10,7 +10,7 @@ This module is for the Endpoint Manager/Intune View. It manages Export/Import/Co
#>
function Get-ModuleVersion
{
'3.1.10'
'3.1.11'
}
function Invoke-InitializeModule
@@ -119,6 +119,8 @@ function Invoke-InitializeModule
Permissons=@("Policy.Read.All","Policy.ReadWrite.ConditionalAccess","Application.Read.All")
Dependencies = @("NamedLocations","Applications")
GroupId = "ConditionalAccess"
ImportExtension = { Add-ConditionalAccessImportExtensions @args }
PreImportCommand = { Start-PreImportConditionalAccess @args }
})
Add-ViewItem (New-Object PSObject -Property @{
@@ -2432,5 +2434,61 @@ function Start-PreUpdateFeatureUpdates
}
#endregion
#region Conditional Access
function Add-ConditionalAccessImportExtensions
{
param($form, $buttonPanel, $index = 0)
$xaml = @"
<StackPanel $($global:wpfNS) Orientation="Horizontal" Margin="0,0,5,0">
<Label Content="Conditional Access State" />
<Rectangle Style="{DynamicResource InfoIcon}" ToolTip="Specifies the enable state of Conditional Access policies" />
</StackPanel>
"@
$label = [Windows.Markup.XamlReader]::Parse($xaml)
$CAStates = @()
$CAStates += [PSCustomObject]@{
Name = "As Exported"
Value = "AsExported"
}
$CAStates += [PSCustomObject]@{
Name = "Report-only"
Value = "enabledForReportingButNotEnforced"
}
$CAStates += [PSCustomObject]@{
Name = "On"
Value = "enabled"
}
$CAStates += [PSCustomObject]@{
Name = "Off"
Value = "disabled"
}
$global:cbImportCAState = [System.Windows.Controls.ComboBox]::new()
$global:cbImportCAState.DisplayMemberPath = "Name"
$global:cbImportCAState.SelectedValuePath = "Value"
$global:cbImportCAState.ItemsSource = $CAStates
$global:cbImportCAState.SelectedValue = "AsExported"
$global:cbImportCAState.Margin="0,5,0,0"
$global:cbImportCAState.HorizontalAlignment="Left"
$global:cbImportCAState.Width=250
@($label, $global:cbImportCAState)
}
function Start-PreImportConditionalAccess
{
param($obj, $objectType, $file, $assignments)
if($global:cbImportCAState.SelectedValue -and $global:cbImportCAState.SelectedValue -ne "AsExported")
{
$obj.state = $global:cbImportCAState.SelectedValue
}
}
#endregion
Export-ModuleMember -alias * -function *

View File

@@ -10,7 +10,7 @@ This module manages Microsoft Grap fuctions like calling APIs, managing graph ob
#>
function Get-ModuleVersion
{
'3.1.5'
'3.1.6'
}
$global:MSGraphGlobalApps = @(
@@ -955,7 +955,7 @@ function Show-GraphImportForm
}
}
Add-GraphImportExtensions $script:importForm 1
Add-GraphImportExtensions $script:importForm 1 $global:curObjectType
if($global:txtImportPath.Text)
{
@@ -1010,9 +1010,9 @@ function Show-GraphBulkImportForm
Selected = (?? $objType.BulkImport $true)
ObjectType = $objType
}
}
Add-GraphImportExtensions $script:importForm 0
Add-GraphImportExtensions $script:importForm 0 $objType
}
$column = Get-GridCheckboxColumn "Selected"
$global:dgObjectsToImport.Columns.Add($column)
@@ -1161,12 +1161,14 @@ function Add-GraphExportExtensions
function Add-GraphImportExtensions
{
param($form, $buttonIndex = 0)
param($form, $buttonIndex = 0, $objectTypes)
if($global:curObjectType.ImportExtension)
foreach($objectType in $objectTypes)
{
if($objectType.ImportExtension)
{
$grid = $form.FindName("grdImportProperties")
$extraProperties = & $global:curObjectType.ExportExtension $global:curObjectType.ExportExtension $form "spExportSubMenu" 1
$extraProperties = & $objectType.ImportExtension $form "spExportSubMenu" 1
for($i=0;($i + 1) -lt (($extraProperties) | measure).Count;$i ++)
{
$rd = [System.Windows.Controls.RowDefinition]::new()
@@ -1182,6 +1184,7 @@ function Add-GraphImportExtensions
}
}
}
}
function Show-GraphBulkDeleteForm
@@ -2234,7 +2237,7 @@ function Import-GraphObject
}
}
$json = ConvertTo-Json $obj -Depth 10
$json = ConvertTo-Json $obj -Depth 20
if($fromFile)
{
# Call Update-JsonForEnvironment before importing the object

View File

@@ -1,5 +1,17 @@
# Release Notes
## 3.2.2 - 2021-09-23
**New features**
- Added support for setting Conditional Access policy state during import. The default setting is to import Conditional Access policies with the same sate as they were exported.
This is based on feature request [Issue 25](https://github.com/Micke-K/IntuneManagement/issues/25)
Note: Security defaults must be disabled before Conditional Access policies can be imported as Enabled.
**Fixes**
* Fixed bugs when using the ImportExtension command
## 3.2.1 - 2021-09-04
**New features**
@@ -17,7 +29,7 @@
* General
* Custom Device Configuration profiles will convert encrypted OMA URI values when the full object is loaded instead during Copy and Export.
* Custom Device Configuration profiles will convert encrypted OMA URI values when the full object is loaded instead of only during Copy and Export.
* All file exports are now saved in UTF8
* Compare