Giter Site home page Giter Site logo

partner-center-sdk-samples's Introduction

partner-center-sdk-samples's People

Contributors

alidhia avatar raedjarrar avatar telezhnaya avatar trinadhryali avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

partner-center-sdk-samples's Issues

Get audit records return {"message":"The request is invalid."}

I don't know if its OK to report issues of the Partner Center managed SDK here. But still.
When I run the demo and search of audit records, any variant of the demo always return:

Retrieving the partner's audit records - start date: 07/01/2017 00:00:00 | page size: 10.....

Partner Exception:
Error Category: BadInput
Service Error Payload: null
Context: Request Id: 3265bc8a-128b-4f99-bf01-32dd5d2769db, Correlation Id: 6873c7eb-db74-437f-bec9-1a9f42381018, Locale: en-US
Base Description: Microsoft.Store.PartnerCenter.Exceptions.PartnerException: {"message":"The request is invalid."}
en Microsoft.Store.PartnerCenter.PartnerService.SynchronousExecute[T](Func1 operation) en Microsoft.Store.PartnerCenter.AuditRecords.AuditRecordsCollection.Query(DateTime startDate, Nullable1 endDate, IQuery query)
en Microsoft.Store.PartnerCenter.Samples.Orders.QueryAuditRecords.RunScenario() en E:\Jeff\My Projects\casabe\CSP\Doc\PartnerCenter\MSPCSDK\Source\Partner Center SDK Samples\Auditing\QueryAuditRecords.cs:línea 38
en Microsoft.Store.PartnerCenter.Samples.BasePartnerScenario.Run() en E:\Jeff\My Projects\casabe\CSP\Doc\PartnerCenter\MSPCSDK\Source\Partner Center SDK Samples\BasePartnerScenario.cs:línea 78

Configuration is OK, since all other operations such as Getting the customer's list, or the list of subscriptions of a customer work perfectly fine.

By the way, I'm using a sandbox Partner Center account, I don't know for sure that this has something to do with the problem.

Exception: Quantity is not a valid decimal

Get an exception when load azure subscription utilization.
Exception: ""
More information in attached file.

Also it seems it is quite slow to get utilization on 1 subscription for 1 day back?
Any suggestion?

Regards,
Salman

capture

LoginUserToAad throws an AadServiceException

Following code line in LoginUserToAad produces an exception:
return authContext.AcquireToken(
Properties.Settings.Default.ResourceUrl,
Properties.Settings.Default.AppId,
userCredentials);

Exception text:
AADSTS90014: The request body must contain the following parameter: 'client_secret or client_assertion'

Do I can add these request bodies somehow? Can I use for UserAuthentication.ApplicationId the id from AppAuthentication.ApplicationId?

US Country not currently supported

The Create new customer scenario throws a bad request exception code 20000, saying Current country not supported which by default is set to US. Changing country to a valid GB address in CreateCustomer.RunScenario works however.
In my case I removed the State field, changed country to GB and switched city and postal code to some random place in England.

How to update the MPNID using AppPartnerOperations When creating an Order

Hi,
Using REST API calls for Partner Center AI authentication in web application how can we update the MPN ID when creating a new order. I have passed MPNID with PartnerIdOnRecord Parameter. I am getting unauthorized error when placing the order with MPNID. If I have passed without MPNID I can able to place the order successfully. Please provide me REST API calls for Partner Center AI authentication.

Thanks & Regards,
Kailasam.

Customer Vs Partner Managed subscriptions

What is the difference between Customer Vs Partner Managed Agreements ?
Even when we revoke the Partner Delegated Admin permission, the subscriptions stays in the "Partner managed subscriptions" - Why is this?

Why can't a customer manage the subscription?
Is it possible to change the code to enable customer to still be able to manage these subscriptions ? Can we get some pointers for this ?

Thank you
Barry

The user or administrator has not consented to use the application with ID 'xxx' named 'AppName'. Send an interactive authorization request for this user and resource

Dear community

We are trying to have a look at the Partner-Center-SDK-Samples project to see what and how we could implement certain features/functionalities within this sample. We have registered an Native app in the Azure portal, granted ALL permissions available and than clicking on the "grant permission" button in the portal as well as with this url (real values left out) https://login.microsoftonline.com/TenantNameHere/oauth2/authorize?prompt=admin_consent&client_id=
ApplicationIdComesHere&response_type=code&redirect_uri=
http://localhost&login_hint=AccountLoginHere
, we do receive the prompt for all permissions and accept it, how ever (even after + 1 hour waiting) we keep getting this error when authenticating: **Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException: AADSTS65001: The user or administrator has not consented to use the application with ID 'ApplicationIDHere' named 'PartnerSDKNative'. Send an interactive authorization request for this user and resource. Trace ID: 877998ed-d3ef-447c-bed7-5ca3996e3100 Correlation ID: 11280449-870a-4364-ba33-cb53772dca8a Timestamp: 2018-07-03 09:13:00Z ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.**

No idea what we are overseeing here ... Account is global admin, rights are granted, ApplicationId is inserted in the app.config along with the rest of values we must provide. I can see in the manifest that "oauth2Permissions": [], is empty, shouldn't that be filled with the permissions we granted?

We have followed the following steps from these sources but with no success: https://www.koskila.net/2017/11/20/how-to-fix-admin-consent-issues-aadsts65001/

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/d091b15d-8e5d-467b-9ea4-b947ae78dc81/the-user-or-administrator-has-not-consented-to-use-the-application-with-id-xxxxxx-send-an?forum=partnercenterapi

https://www.red-gate.com/simple-talk/cloud/security-and-compliance/azure-active-directory-part-3-developing-native-client-applications/

Does anyone have any suggestions?
Thank you in advance!

AADSTS65001

I get an error that leaves me puzzled.
"UserCredential" does not contain a constructor, that accepts 2 Arguments.

When I try to look at the definiton, I see this, which confirms the error.

 public class UserCredential{

 public UserCredential();  
  
 public UserCredential(string userName);

 public string UserName { get; }}}

And I just don't seem to get what the problem might be. Why would a codesample use this? Am I missing something?

SubscriptionId in Azure Subscription Utilization Records in case sensitive

The API only works with uppercase GUIDS in /subscriptions/

The following request works:
https://api.partnercenter.microsoft.com/v1/customers/91fafcd9-xxxx-xxxx-xxxx-a8f2c544f835/subscriptions/C7F6819F-XXXX-XXXX-XXXX-8F2DFB6BF65D/utilizations/azure?start_time=2017-01-28T00%3A00%3A00Z&end_time=2017-01-31T23%3A59%3A59Z&granularity=Daily&show_details=True&size=100

Running the following request:
https://api.partnercenter.microsoft.com/v1/customers/91fafcd9-xxxx-xxxx-xxxx-a8f2c544f835/subscriptions/c7f6819f-xxxx-xxxx-xxxx-8f2dfb6bf65d/utilizations/azure?start_time=2017-01-28T00%3A00%3A00Z&end_time=2017-01-31T23%3A59%3A59Z&granularity=Daily&show_details=True&size=100

Results in:
{"code":3000,"description":"A subscription with the provided ID was not found under this customer","data":["subscription_id"],"source":"PartnerFD"}

Notice that parts of the GUIDs are replaced for privacy reasons.

TAG Information & Resource Groups

Hi,

Is there a possibility to get Tag information from the API. Tags on resources for example?
Also resource groups?

Regards,
Salman

(Another) The supplied role does not have the rights to perform the requested operation

I am attempting to perform the Customer samples -> Get Paged customers action and am receiving the error.

The output of the console window is:

Get Paged customers
--------------------------------------------------------------------------------


Authenticating user.....

Authenticated!

Querying customers.

Partner Exception:
Error Category: Forbidden
Service Error Payload: null
Context: Request Id: 21dd9fd0-db18-4fe6-8e54-cc06620604fa, Correlation Id: 6a42f4ee-f112-4081-8884-a7369f21ad60, Locale: en-US
Base Description: Microsoft.Store.PartnerCenter.Exceptions.PartnerException: The supplied role does not have the rights to perform the requested operation.
   at Microsoft.Store.PartnerCenter.PartnerService.SynchronousExecute[T](Func`1 operation)
   at Microsoft.Store.PartnerCenter.Customers.CustomerCollectionOperations.Query(IQuery customersQuery)
   at Microsoft.Store.PartnerCenter.Samples.Customers.GetPagedCustomers.RunScenario() in C:\Users\gbartley\Desktop\Partner-Center-SDK-Samples-master\Source\Partner Center SDK Samples\Customers\GetPagedCustomers.cs:line 42
   at Microsoft.Store.PartnerCenter.Samples.BasePartnerScenario.Run() in C:\Users\gbartley\Desktop\Partner-Center-SDK-Samples-master\Source\Partner Center SDK Samples\BasePartnerScenario.cs:line 78


Press Q return to the previous screen or R to repeat the current scenario:

I have created the native app registration in Azure AD with the following delegated permissions:

  • Windows Azure Active Directory
    • Access the directory as the signed-in user
    • Read all users' basic profiles
    • Sign in and read user profile
  • Microsoft Partner Center (SampleBECApp)
    • Access Partner Center

The app is registered in Partner Center as a native app using the "Register existing app" link and selected the app that was registered in Azure AD.

The user account I am using is a global admin in both Partner Center and Azure AD.

I have populated the ApplicationId, UserName, and Password values in the UserAuthentication section of App.config with the values from the Partner Center/Azure AD app registration.

However, in the AppAuthentication section of App.config, I am unsure of what to enter for the ApplicationId and ApplicationSecret fields. The only way I have found to get a secret key is to create a web app registration in Partner Center. I have been searching and experimenting for days to try to figure this portion out to no avail. The only scenarios I have found that mention a key or secret is in regards to a Partner Center web app configuration.

Any help would be greatly appreciated! And let me know if I left anything out that may be useful for debugging.

Thank you!

Unable to run samples

When I try and create a new customer using the samples I get the following errors:

Severity	Code	Description	Project	File	Line	Suppression State
Error	CS1729	'UserCredential' does not contain a constructor that takes 2 arguments	Partner Center SDK Samples	C:\Users\Administrator\Downloads\Partner-Center-SDK-Samples\Source\Partner Center SDK Samples\Context\ScenarioContext.cs	141	Active

Severity	Code	Description	Project	File	Line	Suppression State
Error	CS1061	'AuthenticationContext' does not contain a definition for 'AcquireToken' and no extension method 'AcquireToken' accepting a first argument of type 'AuthenticationContext' could be found (are you missing a using directive or an assembly reference?)	Partner Center SDK Samples	C:\Users\Administrator\Downloads\Partner-Center-SDK-Samples\Source\Partner Center SDK Samples\Context\ScenarioContext.cs	147	Active

It's interesting that having looked into the second error a little the authcontext only appears to support AcquireTokenAsync.

Apologies this is pretty much the first time I have done anything with .NET so could easily be an mistake in the setup :/

GetInvoiceLineItems

Hi there,

Could someone please advise as to how I can access the items object which is in the invoiceLineItemEnumerator as below. With most of the other objects in the SDK I can access the Items objects but for this one I cannot get to it?

` var invoiceLineItemsCollection = (false ? invoiceOperations.By(invoiceDetail.BillingProvider, invoiceDetail.InvoiceLineItemType).Get() : invoiceOperations.By(Microsoft.Store.PartnerCenter.Models.Invoices.BillingProvider.Office, Microsoft.Store.PartnerCenter.Models.Invoices.InvoiceLineItemType.BillingLineItems).Get(this.invoicePageSize, 0));

                        var invoiceLineItemEnumerator = partnerOperations.Enumerators.InvoiceLineItems.Create(invoiceLineItemsCollection);
                        int pageNumber = 1;

                        foreach (var myobj in invoiceLineItemEnumerator.Current.Items)
                        {
                            Console.WriteLine(myobj.PartnerId);
                        }
                            ;`

The above code only allows me to access The Attributes,BillingProvider and InvoiceLineItemType objects?

your help is much appreciated

How to update the MPNID using AppPartnerOperations When creating an Order

Hi,
Using REST API calls for Partner Center AI authentication in web application how can we update the MPN ID when creating a new order. I have passed MPNID with PartnerIdOnRecord Parameter. I am getting unauthorized error when placing the order with MPNID. If I have passed without MPNID I can able to place the order successfully. Please provide me REST API calls for Partner Center AI authentication.

Thanks & Regards,
Kailasam.

Meter Rates in NOK

Hi,

I am getting meter rates from ratecards in US currency instead of NOK. I have set NOK explicitly in the request but it still does not work.
What is it i am doing wrong?

    protected override void RunScenario()
    {
        var partnerOperations = this.Context.UserPartnerOperations;

        this.Context.ConsoleHelper.StartProgress("Retrieving Azure rate card");
        var azureRateCard = partnerOperations.RateCards.Azure.Get("NOK");
        this.Context.ConsoleHelper.StopProgress();

        this.Context.ConsoleHelper.WriteObject(azureRateCard, "Azure Rate Card");
    }

Salman

start_time is required in Azure Subscription Utilization Records (BUG)

Using the unaltered example from 16 - 1 Retrieve Azure Subscription Utilization Records.

The error message is attached below:

Partner Exception:
Error Category: BadInput
Service Error Payload:
Error code: 2001
Error message: start_time is required
Error data:
start_time


Context: Request Id: 3f7c36f4-b16f-428c-9bbe-9c70d3d3338f, Correlation Id: d3967dd7-e79f-4626-a566-ccb81f0f1156, Locale: en-US
Base Description: Microsoft.Store.PartnerCenter.Exceptions.PartnerException: start_time is required
   at Microsoft.Store.PartnerCenter.PartnerService.SynchronousExecute[T](Func`1 operation)
   at Microsoft.Store.PartnerCenter.Utilization.AzureUtilizationCollectionOperations.Query(DateTimeOffset startTime, DateTimeOffset endTime, AzureUtilizationGranularity granularity, Boolean showDetails, Nullable`1 size)
   at Microsoft.Store.PartnerCenter.Samples.Utilization.GetAzureSubscriptionUtilization.RunScenario() in C:\Projects\Partner-Center-SDK-Samples\Source\Partner Center SDK Samples\Utilization\GetAzureSubscriptionUtilization.cs:line 37
   at Microsoft.Store.PartnerCenter.Samples.BasePartnerScenario.Run() in C:\Projects\Partner-Center-SDK-Samples\Source\Partner Center SDK Samples\BasePartnerScenario.cs:line 78

Request extracted from fiddler:
https://api.partnercenter.microsoft.com/v1/customers/91FAFCD9-XXXX-XXXX-XXXX-A8F2C544F835/subscriptions/C7F6819F-XXXX-XXXX-XXXX-8F2DFB6BF65D/utilizations/azure?start_time=2016-03-01T16.26.07Z&end_time=2017-03-01T16.26.07Z&granularity=Daily&show_details=True&size=100

Changing the dots (.) from 2016-03-01T16.26.07Z into colon (:) 2016-03-01T16:26:07Z and then url encode to 2016-03-01T16%3A26%3A07Z solves the problem. Computer locale/region is Norwegian/Norway.

Some endpoint here for 21V

<add key="PartnerServiceApiEndpoint" value="https://partner.partnercenterapi.microsoftonline.cn" />
<add key="AuthenticationAuthorityEndpoint" value="https://login.chinacloudapi.cn"/>
<add key="GraphEndpoint" value="https://microsoftgraph.chinacloudapi.cn"/>
<add key="CommonDomain" value="common"/>

Retrieve Customers more than 500

Hi,

I am retrieving customers from Partner center using partner center API. This API pulls up to 500 records. How can I retrieve more than 500 customers because I am having more than 500 customers. Please any one
help to resolve this issue.

Thanks,
[email protected]

Getting client_secret or client_assertion error when authenticating

Hi,
I got the below error when trying to authenticate the application. The request body must contain the following parameter: 'client_secret or client_assertion'. My application is web application not an native client application. Is there any code that supports web application?

Run the application for multiple Instances

I wrote my application entirely and referred the configuration process as mentioned in the example.

Now, I'm kind of in a fix. I have to run the entire application twice based on two different user authentication procedure - US instance and UK instance, and possibly more in future.

What would be the best way to approach this scenario considering the current configuration method?

I do understand I need to add multiple user authentication sections in app.config. Any sort of guidance would help.

Need more detailed Azure usage/consumption information

Customers request more details usage information for Azure consumption: Usage per day and per resource, at least per resource group. These details are available in enterprise agreements, but not in CSP/partner center.

How to add existing subscription?

We have this setup and working great but one customer already has a partner managed subscription but would like to manage it. When they log in there doesn't appear to be a way they can do this. It is also not possible for us or Microsoft to delete the current subscription. Is there any way to resolve this?

I can not log in the system through the code, why???

I can not log in the system through the code, why???

The error is as follows:

“Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException”类型的未经处理的异常在 Microsoft.IdentityModel.Clients.ActiveDirectory.dll 中发生
其他信息: user_realm_discovery_failed: User realm discovery failed

My app.config :
<appSettings> <add key="AuthenticationAuthorityEndpoint" value="https://login.chinacloudapi.cn"/> <add key="GraphEndpoint" value="https://graph.chinacloudapi.cn"/> <add key="CommonDomain" value="common"/> <add key="ResourceUrl" value="https://partner.partnercenterapi.microsoftonline.cn"/> <add key="RedirectUrl" value="http://localhost"/> <add key="ApplicationId" value="1625564a-b7f3-4b54-a49c-3f4c5f75b5fd"/> <add key="UserName" value="[email protected]"/> <add key="Password" value="xxxx"/>

error picture:

https://social.msdn.microsoft.com/Forums/getfile/1001051

The credential refresh mechanism provided expired credentials.

Sometimes, we get the following exception. Looks like the refresh mechanism is buggy in ParnterCenter SDK. We call partnerOperations.Enumerators.Utilization.Azure.Create(utilizationRecords) and process the results, the exception is thrown on the await utilizationRecordEnumerator.NextAsync() call.

Microsoft.Store.PartnerCenter.Exceptions.PartnerException: 'The credential refresh mechanism provided expired credentials.

Callstack:

   bei Microsoft.Store.PartnerCenter.Network.PartnerServiceProxy`2.<ValidateCredentialsAsync>d__61.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Microsoft.Store.PartnerCenter.Network.PartnerServiceProxy`2.<SendAsync>d__58.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Microsoft.Store.PartnerCenter.Network.PartnerServiceProxy`2.<GetAsync>d__49.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei Microsoft.Store.PartnerCenter.Enumerators.BaseResourceCollectionEnumerator`1.<NextAsync>d__12.MoveNext()
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   bei System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter.GetResult()
   bei ```

CSP program new mandatory security requirements

Hi,

Does following requirements from Microsoft effects partner center API.
What needs to be done?

Impacted Audience
Partners transacting in the CSP program using CSP capabilities and APIs in the partner center (Indirect providers, direct bill partners and CSP indirect resellers)
Control panel vendors who integrate their solutions with APIs in the partner center

Summary
We have noticed an increasing number of security breaches and fraud incidents in the industry. As our Cloud Solution Provider (CSP) program ecosystem grows, we are extending our secure application model and best practices to our partner ecosystem. We are introducing new mandatory security requirements that help protect our partners in the CSP program ecosystem, as well as customers, from potential security risks caused by unauthorized access to CSP capabilities in the partner center.

The new security requirements include:

  1. Enabling a new secure application model to integrate with APIs in the partner center
  2. Adopting and enabling Multi-Factor Authentication (MFA) to access CSP capabilities and APIs in the partner center

These requirements will enable all parties, including partners in the CSP program, control panel vendors and customers to better protect their infrastructure as well as customer data from potential security risks such as identify theft or other fraud incidents.

Partner Action Required:

  1. Enabling a new secure application model to integrate with APIs in the partner center
    • All control panel vendors and partners in the CSP program who integrate their solutions with Partner Center APIs need to enable the new secure application model
    • Timeline
    • Implementation due date: December 11, 2018
    • Requirement enforcement date begins February 4, 2019
    • Starting February 4, 2019, partners who don’t meet these security requirements will not be able to transact through APIs in the partner center.
    Partner scenarios/Actions required
  2. Partners using APIs directly (Indirect providers, direct bill partners)
    • Start implementing this requirement immediately. Refer to this document – Partner center: secure application model guide.

Get previous month bill for Customer/Subscription/Line Item

I am using Partner center SDK version 1.6. No where i am able to get the method/property using which i can get previous month or custom month bill of a customer or subscription. Can anyone explain how we do. Currently i am able to get current month estimation but not the previous month.

How could get pricing for license-based services using API (REST or Managed) of Microsoft Store Partner Centner

The API of Microsoft Store Partner Center using RateCards returns usage-based services (Azure Services) and can't get license-based services pricing ? I could download the Excel file but my question is , is there any way to get pricing for license-based services using API (REST or Managed) of Microsoft Store Partner Center ?

When getting offers using the API, some information are missing like : ERP Price, List Price, Valid-To Date, Valid-From Date ?

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.