Skip to content

Add Get-PnPGeoAdministrator cmdlet#5378

Merged
gautamdsheth merged 2 commits into
devfrom
gautamdsheth-add-geo-administrator-cmdlet
Jul 3, 2026
Merged

Add Get-PnPGeoAdministrator cmdlet#5378
gautamdsheth merged 2 commits into
devfrom
gautamdsheth-add-geo-administrator-cmdlet

Conversation

@gautamdsheth

Copy link
Copy Markdown
Collaborator

Before creating a pull request, make sure that you have read the contribution file located at

https://github.com/pnp/powerShell/blob/dev/CONTRIBUTING.md

Type

  • Bug Fix
  • New Feature
  • Sample

Related Issues?

N/A

What is in this Pull Request ?

Adds Get-PnPGeoAdministrator to retrieve SharePoint Online geo administrators using the same MultiGeo REST endpoint as the SPO Management Shell cmdlet.

The implementation reuses the existing MultiGeoRestApiClient, adds the GeoAdministrators API call with the SPO minimum API version 1.2-beta, and returns output objects matching the SPO response shape: DisplayName, LoginName, MemberType, ObjectId, and GeoLocation. Documentation and the current nightly changelog are included.

Guidance

N/A

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 3, 2026 20:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new SharePoint Online admin cmdlet, Get-PnPGeoAdministrator, to retrieve tenant geo administrators via the existing MultiGeo REST client.

Changes:

  • Added Get-PnPGeoAdministrator cmdlet that calls the MultiGeo REST API and outputs geo administrator objects.
  • Extended MultiGeoRestApiClient with a GeoAdministrators endpoint and minimum API version gating.
  • Added supporting models/enums plus cmdlet documentation and a changelog entry.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Commands/Utilities/MultiGeo/MultiGeoRestApiClient.cs Adds GeoAdministrators REST call + api-version validation helper.
src/Commands/Model/GeoAdministratorCollection.cs Adds internal wrapper model for the GeoAdministrators API response shape.
src/Commands/Model/GeoAdministrator.cs Adds public output model representing a geo administrator.
src/Commands/Enums/GroupMemberType.cs Adds enum used by GeoAdministrator.MemberType.
src/Commands/Admin/GetGeoAdministrator.cs Adds the Get-PnPGeoAdministrator cmdlet implementation.
documentation/Get-PnPGeoAdministrator.md Adds user-facing cmdlet documentation.
CHANGELOG.md Adds an entry for the new cmdlet (but note the file’s own guidance about not committing changes).

Comment thread CHANGELOG.md Outdated
Comment on lines +549 to +558
private string GetGeoAdministratorsApiVersion()
{
var apiVersion = GetCurrentApiVersion();
if (!IsSupportedApiVersion(apiVersion, GeoAdministratorsMinimumApiVersion))
{
throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, CommandResources.CrossGeoInvalidVersion, GetApplicationVersion()));
}

return apiVersion;
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this as-is intentionally for SPO Management Shell parity. The decompiled GetSPOGeoAdministrator/MultiGeoRestApiClient.GetGeoAdministrators path checks support against V12Beta/1.2-beta and throws CrossGeoInvalidVersion with the application version. Using GetCurrentApiVersion(minimumApiVersion) would change the error text/behavior, which this PR is trying to match exactly.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@gautamdsheth gautamdsheth merged commit 724ad80 into dev Jul 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants