Skip to content

Connect-PnPOnline Azure Environment Discovery from URI Support #2533

@BernieEllis

Description

@BernieEllis

Is your feature request related to a problem? Please describe.
Yes, I'm trying to use PnP PowerShell in a Microsoft national cloud other than Azure Government/GCC High/DoD. The issue is that the Azure environments PnP is designed to work with are limited, therefore I have no way of instructing which Azure AD, Microsoft Graph, and other endpoints it should use to connect to.

Describe the solution you'd like
Continue allowing customers to specify environments like GCC, GCC High, and DoD but also allow Connect-PnPOnline to connect via the discovery pattern shown above, allowing customers in additional Microsoft cloud environments beyond what's currently in src/sdk/PnP.Core/Services/Core/CloudManager.cs to leverage the PnPPowerShell platform for management and automation.

Connect-PnPOnline, could do one of two things:

Honor the environments discovered by Add-AzEnvironment.
Add a new PnPOnline cmdlet to prepare the environment to pass to Connect-PnPOnline
For the second, thinking something like:

Add-PnPOnlineEnvironment -FromUrl https://management.azure.com/metadata/endpoints?api-version=2020-06-01
Connect-PnPOnline -Environment DiscoveredAzureEnvironment

Additional cmdlets, specifically Register-PnPManagementShellAccess and Register-PnPAzureADApp should pick up support from the additional environment support.

Describe alternatives you've considered
We are currently exploring using Microsoft Graph as an alternative, but there are two issues:

  1. We are not yet able to use Connect-MgGraph in this other national cloud.
  2. I'm not sure yet if we have a 100% mapping from PnP PowerShell cmdlets to Microsoft Graph cmdlets we intend to use. In particular, not sure if these cmdlets have Microsoft Graph PowerShell equivalents despite reviewing the documentation:
  • Register-PnPHubSite
  • Unregister-PnpHubsite
  • Add-PnPSiteCollectionAppCatalog
  • Remove-PnPSiteCollectionAppCatalog
  • Add-PnPHubToHubAssociation
  • Get-PnPHubSite
  • Add-PnPSiteCollectionAdmin

Additional context
Microsoft has additional Azure/O365 cloud environments beyond GCC High and DoD. For this reason, Microsoft has added environment discovery capability to Azure PowerShell via Discovering a new Azure environment via Uri using the Add-AzEnvironment cmdlet I can discover an environment via URL to retrieve the appropriate Graph, Azure AD, etc. endpoints for making calls, which is then used to specify as the environment when connecting with Connect-AzAccount.

Connect-PnPOnline, should allow customers to use PnPPowerShell ideally in the same manner:

Add-AzEnvironment -Autodiscover -Url https://management.azure.com/metadata/endpoints?api-version=2020-06-01 (What's returned will be different endpoints for each environment)
Connect-AzEnvironment -Environment DiscoveredAzureEnvX

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions