CopyPastor

Detecting plagiarism made easy.

Score: 1; Reported for: Exact paragraph match Open both answers

Possible Plagiarism

Reposted on 2025-03-24
by Rukmini

Original Post

Original - Posted on 2024-08-23
by Rukmini



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Posting the answer to help community, **to resolve the error** execute the PowerShell script as a normal user and set the execution policy as unrestricted:
```powershell Set-ExecutionPolicy Unrestricted -Scope CurrentUser ```
![enter image description here](https://i.imgur.com/L43LfXO.png)
***I am able to execute the script successfully:***
```powershell $appId = "AppID" $appSecret = ConvertTo-SecureString -String "Secret" -AsPlainText -Force $tenantId = "TenantID" $credential = [PSCredential]::new($appId, $appSecret)
$tokenSplat = @{ ApplicationId = $appId Credential = $credential Scopes = "https://api.partnercenter.microsoft.com/user_impersonation" ServicePrincipal = $true TenantId = $tenantId UseAuthorizationCode = $true }
$token = New-PartnerAccessToken @tokenSplat
$token.RefreshToken
$connectSplat = @{ ApplicationId = $appId Credential = $credential RefreshToken = $token.RefreshToken }
Connect-PartnerCenter @connectSplat
Get-PartnerRole ``` ![enter image description here](https://i.imgur.com/niu7obv.png)
**Note** that: It is not possible to get a list of our Partner Center customer tenants without access to the Partner Center API as we do not meet the criteria to access it.
Hence, you must be having access to the Partner Center API. ***In case if you get access check the below***:
Connect to Partner Center, use the below script:
```powershell $appId = "ClientID" $appSecret = ConvertTo-SecureString -String "Secret" -AsPlainText -Force $tenantId = "TenantID" $credential = [PSCredential]::new($appId, $appSecret)
$tokenSplat = @{ ApplicationId = $appId Credential = $credential Scopes = "https://api.partnercenter.microsoft.com/user_impersonation" ServicePrincipal = $true TenantId = $tenantId UseAuthorizationCode = $true }
$token = New-PartnerAccessToken @tokenSplat
$token.RefreshToken ```
![enter image description here](https://i.imgur.com/20rZlIM.png)
Now connect to Partner Center:
```perl $connectSplat = @{ ApplicationId = $appId Credential = $credential RefreshToken = $token.RefreshToken }
Connect-PartnerCenter @connectSplat ```
As confirmed by you as you have the access there is no way to get access to Partner Center API.
>**Is there maybe a way to view the tenants that are consented with the app? Shouldn't the Graph API have a way to see that?**
To fetch the tenants the multitenant application has consented, you need to be the user of that particular tenant.
- Hence, there is no way to view the tenants that are consented with the app via Microsoft Graph API or any other API.
**Reference:**
[Azure AD Multi-tenant App - Find what tenant provided admin consent - Stack Overflow](https://stackoverflow.com/questions/70451256/azure-ad-multi-tenant-app-find-what-tenant-provided-admin-consent) by RamaraoAdapa

        
Present in both answers; Present only in the new answer; Present only in the old answer;