/MDS-API

This is a sample implementation of an API endpoint for SQL Server Master Data Services (MDS).

Primary LanguageC#

SQL Server Master Data Services (MDS) Web API Sample

Summary

This is a sample implementation of an API endpoint for SQL Server Master Data Services (MDS).

It wraps certain operations exposed by Master Data Manager web service. The Master Data Manager web service is a Windows Communication Foundation (WCF) service that developers use to control Master Data Services features through code.

By using or customizing this API you can automate MDS operations using tools - like Azure Logic Apps or Power Automate - which are more suited to working with OpenAPI / Swagger compliant APIs, as opposed to the older WCF / SOAP supported by MDS.

Prerequisites

  1. A working SQL Server Master Data Services (MDS) instance.
  2. .NET Core v3.1.404 or newer.
  3. A server or service to host this API on. If you're using Microsoft Azure, the Web App Service is a great option.
  4. (Optional) Visual Studio Code or Microsoft Visual Studio.

Setup

  1. Clone this repo on your machine.

  2. Open and edit the appsettings.Development.json file to configure the MDS WCF endpoint URL and Windows credentials:

    "Mds": {
        "ServiceUrl": "<your MDS WCF Service endpoint> - for example https://<server>/MDS/Service/Service.svc",
        "Credentials": {
            "Username": "<username>",
            "Password": "<password>",
            "Domain": "<domain>" 
        }
    }
  3. Build and run the API locally:

    dotnet restore
    dotnet build
    dotnet run
  4. Test that the service is configured correctly.

    Open the https://localhost:5001/MDS/SayHello URL in a browser. You should receive a Hello MDS! message if your MDS configuration is correct.

  5. (Optional) Download the OpenAPI specification file.

    Open the https://localhost:5001/swagger/ URL and browse the Swagger page. You'll also have a link to download the swagger.json spec file.

Hosting the API in Azure App Service

  1. Create a Web App and deploy this API in Azure.

  2. Configure the MDS WCF settings for the API in Azure.

    Open a cloud shell and run the following command (be sure to replace with your own values):

    az webapp config appsettings set --name <web app name> --resource-group <resource group> --settings Mds__ServiceUrl="<your MDS WCF Service endpoint>" Mds__Credentials__Username="<username>" Mds__Credentials__Password="<password>" Mds__Credentials__Domain="<domain>"

    If you prefer, you can use the Azure portal instead to add your settings. The correct names for the settings are:

    • Mds__ServiceUrl
    • Mds__Credentials__Username
    • Mds__Credentials__Password
    • Mds__Credentials__Domain
  3. Secure access to your API. This step is dependent on your organization's cloud security policies.

  4. (Optional) If your MDS instance is hosted on-premises and/or not exposed via a public endpoint, you'll need to either configure Vnet integration or Hybrid connections for your App Service instance, to allow the API to reach MDS.