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

Update MSFT_IntuneAppProtectionPolicyiOS.psm1 - fixes #2942 #2988

Merged
merged 3 commits into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change log for Microsoft365DSC

# UNRELEASED
* MISC
* Added checks in New-M365DSCConnection to ensure beta MSGraph profile is correctly set when requested
FIXES [#2942](https://github.com/microsoft/Microsoft365DSC/issues/2942)

# 1.23.308.1

* AADAdministrativeUnit
Expand Down
72 changes: 72 additions & 0 deletions Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1594,6 +1594,13 @@ function New-M365DSCConnection
-Credential $InboundParameters.Credential `
-SkipModuleReload $Global:CurrentModeIsExport `
-ProfileName $ProfileName

#2942 - check correct profile applied
if (($ProfileName -ne $global:MSCloudLoginConnectionProfile.MicrosoftGraph.ProfileName) -and ($Workload -eq 'MicrosoftGraph') )
{
Select-MgProfile -Name $ProfileName
}

$data.Add('ConnectionType', 'Credential')

try
Expand All @@ -1617,6 +1624,13 @@ function New-M365DSCConnection
-Url $Url `
-SkipModuleReload $Global:CurrentModeIsExport `
-ProfileName $ProfileName

#2942 - check correct profile applied
if (($ProfileName -ne $global:MSCloudLoginConnectionProfile.MicrosoftGraph.ProfileName) -and ($Workload -eq 'MicrosoftGraph') )
{
Select-MgProfile -Name $ProfileName
}

$data.Add('ConnectionType', 'Credential')

try
Expand Down Expand Up @@ -1646,6 +1660,13 @@ function New-M365DSCConnection
-Credential $InboundParameters.Credential `
-SkipModuleReload $Global:CurrentModeIsExport `
-ProfileName $ProfileName

#2942 - check correct profile applied
if (($ProfileName -ne $global:MSCloudLoginConnectionProfile.MicrosoftGraph.ProfileName) -and ($Workload -eq 'MicrosoftGraph') )
{
Select-MgProfile -Name $ProfileName
}

$data.Add('ConnectionType', 'CredentialsWithApplicationId')

try
Expand All @@ -1669,6 +1690,13 @@ function New-M365DSCConnection
-Url $Url `
-SkipModuleReload $Global:CurrentModeIsExport `
-ProfileName $ProfileName

#2942 - check correct profile applied
if (($ProfileName -ne $global:MSCloudLoginConnectionProfile.MicrosoftGraph.ProfileName) -and ($Workload -eq 'MicrosoftGraph') )
{
Select-MgProfile -Name $ProfileName
}

$data.Add('ConnectionType', 'CredentialsWithApplicationId')

try
Expand Down Expand Up @@ -1703,6 +1731,12 @@ function New-M365DSCConnection
-SkipModuleReload $Global:CurrentModeIsExport `
-ProfileName $ProfileName

#2942 - check correct profile applied
if (($ProfileName -ne $global:MSCloudLoginConnectionProfile.MicrosoftGraph.ProfileName) -and ($Workload -eq 'MicrosoftGraph') )
{
Select-MgProfile -Name $ProfileName
}

$data.Add('ConnectionType', 'ServicePrincipalWithPath')
$data.Add('Tenant', $InboundParameters.TenantId)
Add-M365DSCTelemetryEvent -Data $data -Type 'Connection'
Expand Down Expand Up @@ -1762,6 +1796,13 @@ function New-M365DSCConnection
-SkipModuleReload $Global:CurrentModeIsExport `
-ProfileName $ProfileName
}

#2942 - check correct profile applied
if (($ProfileName -ne $global:MSCloudLoginConnectionProfile.MicrosoftGraph.ProfileName) -and ($Workload -eq 'MicrosoftGraph') )
{
Select-MgProfile-Name $ProfileName
}

$data.Add('ConnectionType', 'Credential')
try
{
Expand All @@ -1788,6 +1829,13 @@ function New-M365DSCConnection
-Url $Url `
-SkipModuleReload $Global:CurrentModeIsExport `
-ProfileName $ProfileName

#2942 - check correct profile applied
if (($ProfileName -ne $global:MSCloudLoginConnectionProfile.MicrosoftGraph.ProfileName) -and ($Workload -eq 'MicrosoftGraph') )
{
Select-MgProfile -Name $ProfileName
}

}
$data.Add('ConnectionType', 'ServicePrincipalWithPath')
$data.Add('Tenant', $InboundParameters.TenantId)
Expand All @@ -1811,6 +1859,12 @@ function New-M365DSCConnection
-SkipModuleReload $Global:CurrentModeIsExport `
-ProfileName $ProfileName

#2942 - check correct profile applied
if (($ProfileName -ne $global:MSCloudLoginConnectionProfile.MicrosoftGraph.ProfileName) -and ($Workload -eq 'MicrosoftGraph') )
{
Select-MgProfile -Name $ProfileName
}

$data.Add('ConnectionType', 'ServicePrincipalWithSecret')
$data.Add('Tenant', $InboundParameters.TenantId)
Add-M365DSCTelemetryEvent -Data $data -Type 'Connection'
Expand All @@ -1826,6 +1880,12 @@ function New-M365DSCConnection
-SkipModuleReload $Global:CurrentModeIsExport `
-ProfileName $ProfileName

#2942 - check correct profile applied
if (($ProfileName -ne $global:MSCloudLoginConnectionProfile.MicrosoftGraph.ProfileName) -and ($Workload -eq 'MicrosoftGraph') )
{
Select-MgProfile -Name $ProfileName
}

$data.Add('ConnectionType', 'ServicePrincipalWithSecret')
$data.Add('Tenant', $InboundParameters.TenantId)
Add-M365DSCTelemetryEvent -Data $data -Type 'Connection'
Expand All @@ -1843,6 +1903,12 @@ function New-M365DSCConnection
-ProfileName $ProfileName `
-Url $Url

#2942 - check correct profile applied
if (($ProfileName -ne $global:MSCloudLoginConnectionProfile.MicrosoftGraph.ProfileName) -and ($Workload -eq 'MicrosoftGraph') )
{
Select-MgProfile -Name $ProfileName
}

$data.Add('ConnectionType', 'ServicePrincipalWithThumbprint')
$data.Add('Tenant', $InboundParameters.TenantId)
Add-M365DSCTelemetryEvent -Data $data -Type 'Connection'
Expand All @@ -1859,6 +1925,12 @@ function New-M365DSCConnection
-SkipModuleReload $Global:CurrentModeIsExport `
-ProfileName $ProfileName

#2942 - check correct profile applied
if (($ProfileName -ne $global:MSCloudLoginConnectionProfile.MicrosoftGraph.ProfileName) -and ($Workload -eq 'MicrosoftGraph') )
{
Select-MgProfile -Name $ProfileName
}

$data.Add('ConnectionType', 'ManagedIdentity')
$data.Add('Tenant', $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.TenantId)
Add-M365DSCTelemetryEvent -Data $data -Type 'Connection'
Expand Down