Marketplace.SaaS.Client 2.0.0

dotnet add package Marketplace.SaaS.Client --version 2.0.0
NuGet\Install-Package Marketplace.SaaS.Client -Version 2.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Marketplace.SaaS.Client" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Marketplace.SaaS.Client --version 2.0.0
#r "nuget: Marketplace.SaaS.Client, 2.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Marketplace.SaaS.Client as a Cake Addin
#addin nuget:?package=Marketplace.SaaS.Client&version=2.0.0

// Install Marketplace.SaaS.Client as a Cake Tool
#tool nuget:?package=Marketplace.SaaS.Client&version=2.0.0

.NET Core

Change log

- Started using AutoRest C# generator V3 to take advantage of new features.
- Removed container based code generation. Using the code build target for code generation coming with C# generator V3. Please see the generate.cmd file in the src folder.
- Modified the repo structure for streamlining with the new code generation method.
- Added two C# projects supporting code generation (SaaS and Metering) and one project for building the binary assets (Microsoft.Marketplace.csproj).    

Breaking changes for preview2

- Constructors for the clients are now using classes deriving from Azure.Core.TokenCredential defined in Azure.Identity namespace (in Azure.Identity NuGet package)
- Removed *TokenProvider 
- Removed ListAllSubscriptionsAsync method on the FulfillmentOperations in favor of the generated ListSubscriptions* methods that implement pagination. Please see the tests for different usages.
- Renamed FulfillmentOperations property on the MarketplaceSaaSClient to Fulfillment
- Removed serialization checks on the SubscriberPlan and UsageEvent classes for consistency. The libraries rely on serialization checks on the service side.

Using the client libraries

The library has two clients, one for the SaaS fulfillment API version 2 (MarketplaceSaaSClient) and one for metered billing APIs (MarketplaceMeteringClient).

Both of them use the client credentials flow, service-to-service authentication for authenticating to call the APIs. The clients support both client secrets and X.509 certificates.After registering an single-tenant application on Azure AD, just create a client secret, or use a X.509 to call the constructor as follows:

    new MarketplaceSaaSClient(new ClientSecretCredential(config["TenantId"], config["ClientId"], config["clientSecret"]));

If you want to use an X.509 certificate instead, use ClientCertificateCredential where clientCertificate is of type System*.Security.Cryptography.X509Certificates.X509Certificate2.

        new MarketplaceSaaSClient(new ClientCertificateCredential (config["TenantId"], config["ClientId"], clientCertificate);

Then call the appropriate method corresponding to the API call.

    var subscriptions = await this.sut.Fulfillment.ListSubscriptionsAsync().ToListAsync();

Running the tests

We are using the Azure.Core.TestFramework from the Azure SDK for .NET. Since no NuGet package includes this assembly at the time of the development of this library project, we opted to make a copy of that source tree and directly include in our repository.

We will be turning on the RecordedTestMode.Record each time we generate the client code when the API surface changes or we need to change the implementation. We are including the session recordings, and the tests will be run against the recorded sessions by default.

The tests use the standard .NET core configuration system user secrets for configuration. Simply add user secrets for the following values, using your favorite method, i.e. either "dotnet user-secrets", Visual Studio Code extension, or Visual Studio 2019 user secrets menu option.

  • TenantId
  • ClientId
  • clientSecret

If you want to record your own sessions, turn on recording by modifying the test constructor and use RecordedTestMode.Record, then run the tests.

One test requires a marketplace purchase identification token and you can get it from a landing page link generated from an actual subscription. Simply url-decode it, and set the value in the test.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Marketplace.SaaS.Client:

Repository Stars
Azure/Commercial-Marketplace-SaaS-Accelerator
A reference example with sample code for developers interested publishing transactable, Software as a-Service offers in the Microsoft commercial marketplace.
Version Downloads Last updated
2.0.0 43,694 1/24/2024
1.2.0 47,721 3/30/2023
1.1.0 23,762 8/22/2022
1.0.0 196,518 9/19/2021

New Metering GET api call
Update Operation to SaaSOperation
Upgrade to Net6 and other dependency libraries