Giter Site home page Giter Site logo

Comments (8)

ili101 avatar ili101 commented on June 15, 2024 2

So "PartnerCenterModule" was deprecated:
https://github.com/microsoft/PartnerCenterPowerShellModule

And replaced with "PartnerCenter" that is abandoned:
https://github.com/microsoft/Partner-Center-PowerShell

Now you can do some of the stuff by using "MSOnline" but it also deprecated:
https://docs.microsoft.com/en-us/powershell/module/msonline/?view=azureadps-1.0

And replaced with "AzureAD" (Azure Active Directory V2) that is deprecated:
https://docs.microsoft.com/en-us/powershell/azure/active-directory/overview?view=azureadps-2.0&preserve_view=true

And replaced with "Microsoft.Graph" that can give you 10% of what you need:
https://docs.microsoft.com/en-us/powershell/microsoftgraph/overview?view=graph-powershell-1.0

So I see there are a few docs regarding preforming some example operations in C# and REST AP like this :
https://docs.microsoft.com/en-us/partner-center/develop/get-customers-of-an-indirect-reseller

I started converting the C# one to PowerShell

Install-Package -Name 'Microsoft.Store.PartnerCenter' -SkipDependencies -Verbose -Scope CurrentUser
Add-Type -Path "$env:LOCALAPPDATA\PackageManagement\NuGet\Packages\Microsoft.Store.PartnerCenter.3.0.1\lib\netstandard2.0\Microsoft.Store.PartnerCenter.dll" -Verbose
Add-Type -Path "$env:LOCALAPPDATA\PackageManagement\NuGet\Packages\Microsoft.Store.PartnerCenter.3.0.1\lib\netstandard2.0\Microsoft.Store.PartnerCenter.Models.dll" -Verbose
Add-Type -Path "$env:LOCALAPPDATA\PackageManagement\NuGet\Packages\Microsoft.Store.PartnerCenter.3.0.1\lib\netstandard2.0\Microsoft.Store.PartnerCenter.Extensions.dll" -Verbose

$partnerOperations = # How to create this? [Microsoft.Store.PartnerCenter.IAggregatePartner]
$indirectResellerId = 'Tenant GUID'

# Create a filter.
$filter = [Microsoft.Store.PartnerCenter.Models.Query.SimpleFieldFilter]::new(
    [Microsoft.Store.PartnerCenter.Models.Customers.CustomerSearchField]::IndirectReseller.ToString(),
    [Microsoft.Store.PartnerCenter.Models.Query.FieldFilterOperation]::StartsWith,
    $indirectResellerId
)
#<# 
# Create an iQuery object to pass to the Query method.
$myQuery = [Microsoft.Store.PartnerCenter.Models.Query.QueryFactory]::Instance.BuildSimpleQuery($filter)

# Get the collection of matching customers.
$customersPage = $partnerOperations.Customers.Query($myQuery);

<# TBD
# Create a customer enumerator for traversing the customer pages.
$customersEnumerator = partnerOperations.Enumerators.Customers.Create(customersPage);
int pageNumber = 1;

while (customersEnumerator.HasValue)
{
    # Work with the current page.
     foreach (var c in customersEnumerator.Current.Items)
    {
        # Display customer tenant identifier and company name.
        Console.WriteLine(string.Format("{0} - {1}.",c.Id,c.CompanyProfile.CompanyName));
    }
    # Get the next page of customers.
    customersEnumerator.Next();
}
#>
}

But I wasn't able to understand how to create the $partnerOperations
In this module they create it in here:

partnerOperations = await PartnerSession.Instance.ClientFactory.CreatePartnerOperationsAsync(CorrelationId).ConfigureAwait(false);

Maybe we can convert this bit of code to PowerShell? or maybe it is possible to simply run Connect-PartnerCenter and extract it from the module context and just use it?
Can someone help?

from partner-center-powershell.

ili101 avatar ili101 commented on June 15, 2024 1

I took some time to write a readme and made the repo public https://github.com/ili101/PartnerCustomerCommunity.
Everyone that wants to help is welcome to open an issue to discuss or contact me.
we'll see where things goes.

from partner-center-powershell.

penicaudm avatar penicaudm commented on June 15, 2024

As mentioned in the readme:

Partner Center PowerShell is commonly used by partners to manage their Partner Center resources. It is an open source project maintained by the partner community. Since this module is maintained by the partner community, it is not officially supported by Microsoft.

While I don't have insider knowledge, this module has not received attention for a long time and likely will not. It still works for a lot of stuff. I recommend you do not use it and try to move your automation projects to the REST API.

from partner-center-powershell.

slavizh avatar slavizh commented on June 15, 2024

This module was never officially supported by MSFT. The only maintainers were MSFT employees who stopped maintaining it since they moved outside of MSFT or other teams that are outside of Partner Center area. Move to something else as @penicaudm suggested.

from partner-center-powershell.

ili101 avatar ili101 commented on June 15, 2024

Are you guys interested in a community maintained PartnerCenter module?
Build with native PowerShell + the PartnerCenter dlls.
I got almost all the basics already working + 3 cmdlets like Get-PartnerCustomer.
The nice thing is that it's pretty simple to implement more of the cmdlets as they all have similar structure and requires only to know PowerShell to write, so if someone need something that is not included he can easily add it and hopefully also submit a PR so we gradually add more of them to the module.

Is there an interest in using or contributing to such module?

from partner-center-powershell.

mprentice22153 avatar mprentice22153 commented on June 15, 2024

@ili101 I'll admit building a module like this is beyond my programming ability. Rather than re-inventing the wheel can't we expand upon what has already been created as part of this project? Isn't that what GitHub is for? And it looks like there is a new PartnerCenter SDK 3.x that I assume has improvements we need.

As @penicaudm and @slavizh advise, moving directly to the APIs is probably the best answer, and something for me to start digging into.

from partner-center-powershell.

ili101 avatar ili101 commented on June 15, 2024

@mprentice22153 Freaking Covid finely got to me, so wasn't available.
As I said I have working REST and "PS + dlls" working examples, the only core functionality missing is the token refresh for when your script need to run over 3 hours. I can clean it up and share.
You raise a good point. the options as I see are:

Advantages Disadvantages
Fork this project (C#) It already exists, just need to update and maintain it. Need people that know and want to maintain a C# project.
PowerShell using dlls Can be maintained and contributed by anyone with PS knowledge. Also need basic classes usage knowledge in PS.
PowerShell using REST Can be maintained and contributed by anyone with PS knowledge. Need to manually handle the API with its oddities.

Examples

https://docs.microsoft.com/en-us/partner-center/develop/get-an-organization-profile

# Get-PartnerOrganizationProfile with the dlls is one line:
$PartnerOperations.Profiles.OrganizationProfile.Get()

# Get-PartnerOrganizationProfile with REST:
$Response = Invoke-RestMethod -ContentType 'application/json;charset=utf-8' -Uri 'https://api.partnercenter.microsoft.com/v1/profiles/organization' -Headers @{
    "Authorization"    = "Bearer " + $AccessToken
    'Accept'           = 'application/json;charset=utf-8'
    'MS-RequestId'     = 'b85cb7ab-cc2e-4966-93f0-cf0d8377a93f'
    'MS-CorrelationId' = '1bb03149-88d2-4bc2-9cc1-d6e83890fa9e'
}
$Response.Substring(1) | ConvertFrom-Json # They put a BOM in it, so strange.

So in assume the easiest solution is to find someone to maintain this module as you mentioned.
If not I think that working with the classes is preferable to the API directly as it mitigates some of its weirdness.

from partner-center-powershell.

mprentice22153 avatar mprentice22153 commented on June 15, 2024

@ili101 Please contact me directly. I'm curious to understand this more and hopefully help with this.

from partner-center-powershell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.