Skip to content

Commit

Permalink
Merge pull request #1241 from microsoft/Dev
Browse files Browse the repository at this point in the history
Release 1.21.526.2
  • Loading branch information
NikCharlebois authored May 26, 2021
2 parents 89ef732 + 70dbb30 commit 5729b25
Show file tree
Hide file tree
Showing 150 changed files with 1,522 additions and 1,000 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Change log for Microsoft365DSC
1.21.526.1
1.21.526.2
* EXOSafeAttachmentRule
* Fixed issue #1213 Policy X already has rule Y associated with it
if rule exists already
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,8 @@ function Export-TargetResource
}

$dscContent += $currentDSCBlock
Save-M365DSCPartialExport -Content $currentDSCBlock `
-FileName $Global:PartialExportFileName
Write-Host $Global:M365DSCEmojiGreenCheckMark
$i++
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1810,29 +1810,42 @@ function Export-TargetResource
[array] $Policies = Get-AzureADMSConditionalAccessPolicy
$i = 1
$dscContent = ''
Write-Host "`r`n" -NoNewline
foreach ($Policy in $Policies)

if ($Policies.Length -eq 0)
{
Write-Host " |---[$i/$($Policies.Count)] $($Policy.DisplayName)" -NoNewline
$Params = @{
GlobalAdminAccount = $GlobalAdminAccount
DisplayName = $Policy.DisplayName
Id = $Policy.Id
ApplicationId = $ApplicationId
TenantId = $TenantId
CertificateThumbprint = $CertificateThumbprint
}
$Results = Get-TargetResource @Params
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
$dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName `
-ConnectionMode $ConnectionMode `
-ModulePath $PSScriptRoot `
-Results $Results `
-GlobalAdminAccount $GlobalAdminAccount
Write-Host $Global:M365DSCEmojiGreenCheckMark
$i++
}
else
{
Write-Host "`r`n" -NoNewline
foreach ($Policy in $Policies)
{
Write-Host " |---[$i/$($Policies.Count)] $($Policy.DisplayName)" -NoNewline
$Params = @{
GlobalAdminAccount = $GlobalAdminAccount
DisplayName = $Policy.DisplayName
Id = $Policy.Id
ApplicationId = $ApplicationId
TenantId = $TenantId
CertificateThumbprint = $CertificateThumbprint
}
$Results = Get-TargetResource @Params
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
$currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName `
-ConnectionMode $ConnectionMode `
-ModulePath $PSScriptRoot `
-Results $Results `
-GlobalAdminAccount $GlobalAdminAccount

$dscContent += $currentDSCBlock
Save-M365DSCPartialExport -Content $currentDSCBlock `
-FileName $Global:PartialExportFileName
Write-Host $Global:M365DSCEmojiGreenCheckMark
$i++
}
}

return $dscContent
}
catch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,17 @@ function Export-TargetResource
{
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
$dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName `
$currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName `
-ConnectionMode $ConnectionMode `
-ModulePath $PSScriptRoot `
-Results $Results `
-GlobalAdminAccount $GlobalAdminAccount
$dscContent += $currentDSCBlock
}

Save-M365DSCPartialExport -Content $currentDSCBlock `
-FileName $Global:PartialExportFileName

Write-Host $Global:M365DSCEmojiGreenCheckMark
return $dscContent
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function Get-TargetResource
$nullReturn.Ensure = "Absent"
try
{
$Policy = Get-AzureADDirectorySetting | Where-Object -FilterScript {$_.DisplayName -eq "Group.Unified"}
$Policy = Get-AzureADDirectorySetting | Where-Object -FilterScript { $_.DisplayName -eq "Group.Unified" }

if ($null -eq $Policy)
{
Expand All @@ -93,19 +93,19 @@ function Get-TargetResource
$AllowedGroupName = $groupObject.DisplayName
}
$result = @{
IsSingleInstance = 'Yes'
EnableGroupCreation = [Boolean]::Parse($Policy["EnableGroupCreation"])
AllowGuestsToBeGroupOwner = [Boolean]::Parse($Policy["AllowGuestsToBeGroupOwner"])
AllowGuestsToAccessGroups = [Boolean]::Parse($Policy["AllowGuestsToAccessGroups"])
GuestUsageGuidelinesUrl = $Policy["GuestUsageGuidelinesUrl"]
GroupCreationAllowedGroupName = $AllowedGroupName
AllowToAddGuests = [Boolean]::Parse($Policy["AllowToAddGuests"])
UsageGuidelinesUrl = $Policy["UsageGuidelinesUrl"]
Ensure = "Present"
GlobalAdminAccount = $GlobalAdminAccount
ApplicationId = $ApplicationId
TenantId = $TenantId
CertificateThumbprint = $CertificateThumbprint
IsSingleInstance = 'Yes'
EnableGroupCreation = [Boolean]::Parse($Policy["EnableGroupCreation"])
AllowGuestsToBeGroupOwner = [Boolean]::Parse($Policy["AllowGuestsToBeGroupOwner"])
AllowGuestsToAccessGroups = [Boolean]::Parse($Policy["AllowGuestsToAccessGroups"])
GuestUsageGuidelinesUrl = $Policy["GuestUsageGuidelinesUrl"]
GroupCreationAllowedGroupName = $AllowedGroupName
AllowToAddGuests = [Boolean]::Parse($Policy["AllowToAddGuests"])
UsageGuidelinesUrl = $Policy["UsageGuidelinesUrl"]
Ensure = "Present"
GlobalAdminAccount = $GlobalAdminAccount
ApplicationId = $ApplicationId
TenantId = $TenantId
CertificateThumbprint = $CertificateThumbprint
}

Write-Verbose -Message "Get-TargetResource Result: `n $(Convert-M365DscHashtableToString -Hashtable $result)"
Expand Down Expand Up @@ -220,7 +220,7 @@ function Set-TargetResource
$needToUpdate = $true
}

$Policy = Get-AzureADDirectorySetting | Where-Object -FilterScript {$_.DisplayName -eq "Group.Unified"}
$Policy = Get-AzureADDirectorySetting | Where-Object -FilterScript { $_.DisplayName -eq "Group.Unified" }

if (($Ensure -eq 'Present' -and $currentPolicy.Ensure -eq 'Present') -or $needToUpdate)
{
Expand All @@ -230,13 +230,13 @@ function Set-TargetResource
{
$groupId = $groupObject.ObjectId
}
$Policy["EnableGroupCreation"] = [System.Boolean]$EnableGroupCreation
$Policy["AllowGuestsToBeGroupOwner"] = [System.Boolean]$AllowGuestsToBeGroupOwner
$Policy["AllowGuestsToAccessGroups"] = [System.Boolean]$AllowGuestsToAccessGroups
$Policy["GuestUsageGuidelinesUrl"] = $GuestUsageGuidelinesUrl
$Policy["GroupCreationAllowedGroupId"] = $groupId
$Policy["AllowToAddGuests"] = [System.Boolean]$AllowToAddGuests
$Policy["UsageGuidelinesUrl"] = $UsageGuidelinesUrl
$Policy["EnableGroupCreation"] = [System.Boolean]$EnableGroupCreation
$Policy["AllowGuestsToBeGroupOwner"] = [System.Boolean]$AllowGuestsToBeGroupOwner
$Policy["AllowGuestsToAccessGroups"] = [System.Boolean]$AllowGuestsToAccessGroups
$Policy["GuestUsageGuidelinesUrl"] = $GuestUsageGuidelinesUrl
$Policy["GroupCreationAllowedGroupId"] = $groupId
$Policy["AllowToAddGuests"] = [System.Boolean]$AllowToAddGuests
$Policy["UsageGuidelinesUrl"] = $UsageGuidelinesUrl

Set-AzureADDirectorySetting -Id $Policy.id -DirectorySetting $Policy
}
Expand Down Expand Up @@ -375,21 +375,24 @@ function Export-TargetResource
{
$ConnectionMode = New-M365DSCConnection -Platform 'AzureAD' -InboundParameters $PSBoundParameters
$Params = @{
ApplicationId = $ApplicationId
TenantId = $TenantId
CertificateThumbprint = $CertificateThumbprint
IsSingleInstance = 'Yes'
GlobalAdminAccount = $GlobalAdminAccount
ApplicationId = $ApplicationId
TenantId = $TenantId
CertificateThumbprint = $CertificateThumbprint
IsSingleInstance = 'Yes'
GlobalAdminAccount = $GlobalAdminAccount
}
$dscContent = ''
$Results = Get-TargetResource @Params
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
$dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName `
$currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName `
-ConnectionMode $ConnectionMode `
-ModulePath $PSScriptRoot `
-Results $Results `
-GlobalAdminAccount $GlobalAdminAccount
$dscContent += $currentDSCBlock
Save-M365DSCPartialExport -Content $currentDSCBlock `
-FileName $Global:PartialExportFileName
Write-Host $Global:M365DSCEmojiGreenCheckMark
return $dscContent
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,15 @@ function Export-TargetResource
$Results = Get-TargetResource @Params
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
$dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName `
$currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName `
-ConnectionMode $ConnectionMode `
-ModulePath $PSScriptRoot `
-Results $Results `
-GlobalAdminAccount $GlobalAdminAccount
$dscContent += $currentDSCBlock
Save-M365DSCPartialExport -Content $currentDSCBlock `
-FileName $Global:PartialExportFileName

Write-Host $Global:M365DSCEmojiGreenCheckMark
$i++
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,16 @@ function Export-TargetResource
{
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
$dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName `
$currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName `
-ConnectionMode $ConnectionMode `
-ModulePath $PSScriptRoot `
-Results $Results `
-GlobalAdminAccount $GlobalAdminAccount
$dscContent += $currentDSCBlock
Save-M365DSCPartialExport -Content $currentDSCBlock `
-FileName $Global:PartialExportFileName
}

Write-Host $Global:M365DSCEmojiGreenCheckMark

return $dscContent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,11 +370,15 @@ function Export-TargetResource
{
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
$dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName `
$currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName `
-ConnectionMode $ConnectionMode `
-ModulePath $PSScriptRoot `
-Results $Results `
-GlobalAdminAccount $GlobalAdminAccount
$dscContent += $currentDSCBlock
Save-M365DSCPartialExport -Content $currentDSCBlock `
-FileName $Global:PartialExportFileName

Write-Host $Global:M365DSCEmojiGreenCheckMark
$i++
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function Get-TargetResource
catch
{
Write-Verbose -Message $_
ADD-M365DSCEvent -Message $_ -EntryType 'Error' `
Add-M365DSCEvent -Message $_ -EntryType 'Error' `
-EventID 1 -Source $($MyInvocation.MyCommand.Source)
}
}
Expand Down Expand Up @@ -362,11 +362,15 @@ function Export-TargetResource
{
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
$dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName `
$currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName `
-ConnectionMode $ConnectionMode `
-ModulePath $PSScriptRoot `
-Results $Results `
-GlobalAdminAccount $GlobalAdminAccount
$dscContent += $currentDSCBlock
Save-M365DSCPartialExport -Content $currentDSCBlock `
-FileName $Global:PartialExportFileName

Write-Host $Global:M365DSCEmojiGreenCheckMark
$i++
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,14 @@ function Export-TargetResource
{
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
$dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName `
$currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName `
-ConnectionMode $ConnectionMode `
-ModulePath $PSScriptRoot `
-Results $Results `
-GlobalAdminAccount $GlobalAdminAccount
$dscContent += $currentDSCBlock
Save-M365DSCPartialExport -Content $currentDSCBlock `
-FileName $Global:PartialExportFileName
}

Write-Host $Global:M365DSCEmojiGreenCheckMark
Expand All @@ -404,7 +407,7 @@ function Export-TargetResource
}
catch
{
write-host $_
Write-Host $_
Write-Verbose -Message $_
Add-M365DSCEvent -Message $_ -EntryType 'Error' `
-EventID 1 -Source $($MyInvocation.MyCommand.Source)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,15 @@ function Export-TargetResource
{
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
$dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName `
$currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName `
-ConnectionMode $ConnectionMode `
-ModulePath $PSScriptRoot `
-Results $Results `
-GlobalAdminAccount $GlobalAdminAccount
$dscContent += $currentDSCBlock
Save-M365DSCPartialExport -Content $currentDSCBlock `
-FileName $Global:PartialExportFileName

Write-Host $Global:M365DSCEmojiGreenCheckMark
$i++
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function Get-TargetResource
TenantId = $TenantId
CertificateThumbprint = $CertificateThumbprint
}
Write-Verbose -Message "Get-TargetResource Result: `n $(Convert-M365DSCHashTabletoString -Hashtable $result)"
Write-Verbose -Message "Get-TargetResource Result: `n $(Convert-M365DscHashtableToString -Hashtable $result)"
return $result
}
}
Expand Down Expand Up @@ -320,10 +320,15 @@ function Export-TargetResource
}
$Results = Get-TargetResource @Params
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode -Results $Results
$dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName -ConnectionMode $ConnectionMode `
$currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName -ConnectionMode $ConnectionMode `
-ModulePath $PSScriptRoot `
-Results $Results `
-GlobalAdminAccount $GlobalAdminAccount
$dscContent += $currentDSCBlock

Save-M365DSCPartialExport -Content $currentDSCBlock `
-FileName $Global:PartialExportFileName

Write-Host $Global:M365DSCEmojiGreenCheckMark
return $dscContent
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,14 @@ function Export-TargetResource
$Results = Get-TargetResource @Params
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
$dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName `
$currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName `
-ConnectionMode $ConnectionMode `
-ModulePath $PSScriptRoot `
-Results $Results `
-GlobalAdminAccount $GlobalAdminAccount
$dscContent += $currentDSCBlock
Save-M365DSCPartialExport -Content $currentDSCBlock `
-FileName $Global:PartialExportFileName
Write-Host $Global:M365DSCEmojiGreenCheckMark
$i++
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ function Set-TargetResource
{
Write-Verbose -Message "Active Sync Device Access Rule '$($Identity)' already exists, but needs updating."
Write-Verbose -Message "Setting Active Sync Device Access Rule $($Identity) with values: $(Convert-M365DscHashtableToString -Hashtable $SetActiveSyncDeviceAccessRuleParams)"
$SetActiveSyncDeviceAccessRuleParams.Identity = Get-ActiveSyncDeviceAccessRule | Where {$_.AccessLevel -eq $NewActiveSyncDeviceAccessRuleParams.AccessLevel -and $_.Characteristic -eq $NewActiveSyncDeviceAccessRuleParams.Characteristic -and $_.QueryString -eq $NewActiveSyncDeviceAccessRuleParams.QueryString} | SELECT -ExpandProperty "Identity"
Set-ActiveSyncDeviceAccessRule @SetActiveSyncDeviceAccessRuleParams
}
}
Expand Down Expand Up @@ -406,12 +405,16 @@ function Export-TargetResource
$Results = Get-TargetResource @Params
$Results = Update-M365DSCExportAuthenticationResults -ConnectionMode $ConnectionMode `
-Results $Results
$dscContent += Get-M365DSCExportContentForResource -ResourceName $ResourceName `
$currentDSCBlock = Get-M365DSCExportContentForResource -ResourceName $ResourceName `
-ConnectionMode $ConnectionMode `
-ModulePath $PSScriptRoot `
-Results $Results `
-GlobalAdminAccount $GlobalAdminAccount
Write-Host $Global:M365DSCEmojiGreenCheckMark
Write-Host $Global:M365DSCEmojiGreenCheckMa
$dscContent += $currentDSCBlock

Save-M365DSCPartialExport -Content $currentDSCBlock `
-FileName $Global:PartialExportFileNamerk
$i++
}
return $dscContent
Expand Down Expand Up @@ -443,4 +446,3 @@ function Export-TargetResource
}

Export-ModuleMember -Function *-TargetResource

Loading

0 comments on commit 5729b25

Please sign in to comment.