Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M365DSCUtil: Fix #4333 #4334

Merged
merged 15 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 44 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,54 @@

# UNRELEASED

* AADApplication
* Expose the description field in the resource.
* AADConditionalAccessPolicy
* Fixing issue where Membership kinds no longer accepted empty values.
ROLLING BACK [#4344](https://github.com/microsoft/Microsoft365DSC/issues/4344)
FIXES [#4347](https://github.com/microsoft/Microsoft365DSC/issues/4347)
* Throws an error if role, user or group was not found in the Set method.
FIXES [#4342](https://github.com/microsoft/Microsoft365DSC/issues/4342)
* MISC
* Uninstall-M365DSCOutdatedDependencies
* Outdated Microsoft365DSC-modules are now removed in their entirety
* M365DSCUtil
* When Name is Key of a resource append it to ResourceInstanceName instead
of Id during Export
* Change heuristics on how to find the mandatory key of the resources to
include them as part of the ResourceInstanceName during their export
FIXES [#4333](https://github.com/microsoft/Microsoft365DSC/issues/4333)

# 1.24.214.3

* AADAuthenticationMethodPolicy
* Fixed an error where the Export method would loop through the response header.
* AADAuthenticationMethodPolicyAuthenticator
* Fixed an error where the Export method would loop through the response header.
* AADAuthenticationMethodPolicyEmail
* Fixed an error where the Export method would loop through the response header.
* AADAuthenticationMethodPolicyFido2
* Fixed an error where the Export method would loop through the response header.
* AADAuthenticationMethodPolicySms
* Fixed an error where the Export method would loop through the response header.
* AADAuthenticationMethodPolicySoftware
* Fixed an error where the Export method would loop through the response header.
* AADAuthenticationMethodPolicyTemporary
* Fixed an error where the Export method would loop through the response header.
* AADAuthenticationMethodPolicyVoice
* Fixed an error where the Export method would loop through the response header.
* AADAuthenticationMethodPolicyX509
* Fixed an error where the Export method would loop through the response header.
* IntuneAppConfigurationPolicy
* Fixed an error in the export on the Settings property.
* IntuneDeviceEnrollmentStatusPageWindows10
* Fixed an error where the Export method would loop through the response header.
* IntuneWindowsAutopilotDeploymentProfileAzureADJoined
* Fixed an error where the Export method would loop through the response header.
* SCDLPComplianceRule
* Fixed the NotifyEmailCustomText and NotifyPolicyTipCustomText to escape fancy
quotes.
* DEPENDENCIES
* Updated Microsoft.Graph to version 2.14.1.

# 1.24.214.2

* AADConditionalAccessPolicy
Expand Down
42 changes: 27 additions & 15 deletions Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -3361,38 +3361,50 @@ function Get-M365DSCExportContentForResource
$Results = Format-M365DSCString -Properties $Results `
-ResourceName $ResourceName

if ($Script:AllM365DscResources.Count -eq 0)
{
$Script:AllM365DscResources = Get-DscResource -Module 'Microsoft365Dsc'
}

$primaryKey = ''
andikrueger marked this conversation as resolved.
Show resolved Hide resolved
if ($Results.ContainsKey('IsSingleInstance'))
$Resource = $Script:AllM365DscResources.Where({ $_.Name -eq $ResourceName })
$Keys = $Resource.Properties.Where({ $_.IsMandatory }) | `
andikrueger marked this conversation as resolved.
Show resolved Hide resolved
Select-Object -ExpandProperty Name
if ($Keys.Contains('IsSingleInstance'))
{
$primaryKey = ''
andikrueger marked this conversation as resolved.
Show resolved Hide resolved
}
elseif ($Results.ContainsKey('DisplayName'))
elseif ($Keys.Contains('DisplayName'))
{
$primaryKey = $Results.DisplayName
}
elseif ($Results.ContainsKey('Name'))
elseif ($Keys.Contains('Name'))
{
$primaryKey = $Results.Name
}
elseif ($Results.ContainsKey('Identity'))
elseif ($Keys.Contains('Title'))
{
$primaryKey = $Results.Identity
}
elseif ($Results.ContainsKey('Id'))
{
$primaryKey = $Results.Id
$primaryKey = $Results.Title
}
elseif ($Results.ContainsKey('Title'))
elseif ($Keys.Contains('Identity'))
{
$primaryKey = $Results.Title
$primaryKey = $Results.Identity
}
elseif ($Results.ContainsKey('CdnType'))
elseif ($Keys.Contains('Id'))
{
$primaryKey = $Results.CdnType
$primaryKey = $Results.Id
}
elseif ($Results.ContainsKey('Usage'))

if ([String]::IsNullOrEmpty($primaryKey))
{
$primaryKey = $Results.Usage
if ($Keys.Count -gt 1)
{
$primaryKey = $Results.$Keys -Join ''
andikrueger marked this conversation as resolved.
Show resolved Hide resolved
}
else
{
$primaryKey = $Results.$Keys
}
}

$instanceName = $ResourceName
Expand Down
Loading