Skip to content

Commit

Permalink
Fix for PolicyScopeTag assign and unassign
Browse files Browse the repository at this point in the history
  • Loading branch information
davefalkus committed Jan 28, 2019
1 parent 3617d75 commit 3cbcad1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
4 changes: 2 additions & 2 deletions RBAC/RBAC_ScopeTags_PolicyAssign.ps1
Expand Up @@ -640,8 +640,8 @@ if($Confirm -eq "y" -or $Confirm -eq "Y"){

foreach($ScopeTag in $ScopeTags){

$ScopeTag_DN = (Get-RBACScopeTag -DisplayName $ScopeTag.displayName).displayName
$ScopeTagId = (Get-RBACScopeTag -DisplayName $ScopeTag.displayName).id
$ScopeTag_DN = $ScopeTag.displayName
$ScopeTagId = $ScopeTag.id

Write-Host "Checking Scope Tag '$ScopeTag_DN'..." -ForegroundColor Cyan

Expand Down
29 changes: 17 additions & 12 deletions RBAC/RBAC_ScopeTags_PolicyUnAssign.ps1
@@ -1,14 +1,13 @@

<#
 
<#
.COPYRIGHT
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
See LICENSE in the project root for license information.
#>

####################################################
 

function Get-AuthToken {

<#
Expand Down Expand Up @@ -89,13 +88,13 @@ Write-Host "Checking for AzureAD module..."
[System.Reflection.Assembly]::LoadFrom($adalforms) | Out-Null

$clientId = "d1ddf0e4-d672-4dae-b554-9d5bdfd93547"
 
$redirectUri = "urn:ietf:wg:oauth:2.0:oob"
 
$resourceAppIdURI = "https://graph.microsoft.com"
 
$authority = "https://login.microsoftonline.com/$Tenant"
 
try {

$authContext = New-Object "Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext" -ArgumentList $authority
Expand Down Expand Up @@ -146,7 +145,7 @@ $authority = "https://login.microsoftonline.com/$Tenant"
}

}
 
####################################################

Function Get-DeviceCompliancePolicy(){
Expand Down Expand Up @@ -605,11 +604,17 @@ if($Confirm -eq "y" -or $Confirm -eq "Y"){

$JSON = $Policy | Select-Object * -ExcludeProperty '@odata.context',createdDateTime,lastModifiedDateTime,version,assignments,supportsScopeTags,qualityUpdatesWillBeRolledBack,featureUpdatesWillBeRolledBack | ConvertTo-Json -Depth 5

$Result = Update-DeviceConfigurationPolicy -id $Policy.id -JSON $JSON
$JSON_Conversion = ($JSON | ConvertFrom-Json).'@odata.type'

if($Result -eq ""){
if(($JSON_Conversion -ne "#microsoft.graph.windowsUpdateForBusinessConfiguration") -and ($JSON_Conversion -ne "#microsoft.graph.unsupportedDeviceConfiguration")){

$Result = Update-DeviceConfigurationPolicy -id $Policy.id -JSON $JSON

if($Result -eq ""){

Write-Host "Configuration Policy '$PolicyDN' patched..." -ForegroundColor Gray

Write-Host "Configuration Policy '$PolicyDN' patched..." -ForegroundColor Gray
}

}

Expand Down

0 comments on commit 3cbcad1

Please sign in to comment.