File tree Expand file tree Collapse file tree
Modules/CIPPHTTP/Public/Entrypoints/HTTP Functions Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ function Invoke-ListResellerRelationshipLink {
2+ <#
3+ . FUNCTIONALITY
4+ Entrypoint,AnyTenant
5+ . ROLE
6+ Tenant.Relationship.Read
7+ #>
8+ [CmdletBinding ()]
9+ param ($Request , $TriggerMetadata )
10+
11+ $StatusCode = [HttpStatusCode ]::OK
12+ $Body = @ {}
13+
14+ # Get the indirect reseller relationship invite link
15+ try {
16+ $RelationshipRequest = New-GraphGetRequest - uri ' https://api.partnercenter.microsoft.com/v1/customers/relationshiprequests?dualRoleIndirectRelationship=false' - scope ' https://api.partnercenter.microsoft.com/.default' - NoAuthCheck $true
17+ $Body.inviteUrl = $RelationshipRequest.url
18+ } catch {
19+ $Body.inviteUrl = $null
20+ $Body.inviteUrlError = " Failed to retrieve relationship invite link: $ ( $_.Exception.Message ) "
21+ Write-Information " ListResellerRelationshipLink: Failed to get invite URL - $ ( $_.Exception.Message ) "
22+ }
23+
24+ # Get indirect providers (for Tier 2 / indirect resellers)
25+ try {
26+ $RelationshipsResponse = New-GraphGetRequest - uri ' https://api.partnercenter.microsoft.com/v1/relationships?relationship_type=IsIndirectResellerOf' - scope ' https://api.partnercenter.microsoft.com/.default' - NoAuthCheck $true
27+ $Body.indirectProviders = @ ($RelationshipsResponse.items )
28+ } catch {
29+ $Body.indirectProviders = @ ()
30+ Write-Information " ListResellerRelationshipLink: Failed to get indirect providers - $ ( $_.Exception.Message ) "
31+ }
32+
33+ return [HttpResponseContext ]@ {
34+ StatusCode = $StatusCode
35+ Body = $Body
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments