Internal/Get-ManagedAppConfig_Assignment.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
Function Get-ManagedAppConfig_Assignment(){
    <#
        .SYNOPSIS
        This function is used to get the Managed App Config Assignments from the Graph API REST interface
        .DESCRIPTION
        The function connects to the Graph API Interface and gets the Managed App Config Assignments
        .EXAMPLE
        Get-ManagedAppConfig_Assignment -policyId $id
        Returns the Managed App Config Assignments configured in Intune
        .NOTES
        NAME: Get-ManagedAppConfig_Assignment
        #>

        param(
            $policyId
        )
        try {
            $uri = "https://graph.microsoft.com/Beta/deviceAppManagement/targetedManagedAppConfigurations/$policyId/assignments"
            (Invoke-MSGraphRequest -Url $uri -HttpMethod GET).Value
        } catch {
            $ex = $_.Exception
            $errorResponse = $ex.Response.GetResponseStream()
            $reader = New-Object System.IO.StreamReader($errorResponse)
            $reader.BaseStream.Position = 0
            $reader.DiscardBufferedData()
            $responseBody = $reader.ReadToEnd();
            Write-Log "Response content:`n$responseBody" -Type Error
            Write-Log "Request to $Uri failed with HTTP Status $($ex.Response.StatusCode) $($ex.Response.StatusDescription)" -Type Error
        }
    }
# SIG # Begin signature block
# MIIPGgYJKoZIhvcNAQcCoIIPCzCCDwcCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQULdyEtTI57xSesJxsIanHvlxo
# upugggxqMIIFrTCCBJWgAwIBAgIQBD9LZ/ZeEn/YHaINoG/0ljANBgkqhki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