MSBA-272 · Lesson 6 of 12 · 19 min

Custom connectors

▶ Video coming soon A video version of this lesson is on the way.

Courier delivery was the most expensive transcript option and the most labour-intensive. When a student chose it, a clerk copied the address into the courier company's website, printed a label, and later pasted the tracking number back into the request. The college used a fictional regional courier for this course, Parcelwise, which offered a documented REST API for creating shipments, reading tracking events and notifying customers when a parcel was delivered. Power Platform had no connector for it. Signe had built two custom connectors already, the Student Records connector for hold checks and the LedgerPoint connector for the finance team. She asked Wiremu to build the third, for Parcelwise, so he would learn the whole process.

What a custom connector is

A connector is a wrapper around an API that lets apps, flows and agents call it as a set of typed actions and triggers. Microsoft and partners publish more than a thousand connectors. A custom connector is one an organization defines for an API that has no published connector, or whose published connector lacks operations it needs. Once created, a custom connector looks like any other: makers add a connection, choose an action, and fill in fields.

A custom connector has four parts. The general information gives the host, base URL, icon and description. The security settings say how a connection authenticates, which lesson 7 covers. The definition lists the operations, with their requests and responses, written as an OpenAPI document with some Microsoft extensions. And optional code and policies change requests and responses on the way through, which lesson 8 covers.

A flow and a canvas app on the left call a custom connector in the centre, shown as a box with four layers: general, security, definition, and policies and code. An arrow from the connector goes out to the Parcelwise API on the right. Under the connector, a connection box holds the credentials for one user or service account.
The parts of a custom connector and where the connection sits.

Ways to create one

Wiremu looked at the options Microsoft documents. A connector can be created from blank in the maker portal's wizard, by importing an OpenAPI definition from a file or URL, by importing a Postman collection, or from Azure services such as an API Management instance or an Azure Function. Developers can also create and update connectors from the command line with pac connector commands in the Power Platform CLI, or with the older paconn tool, which makes it possible to keep the definition in source control and deploy it with scripts.

Ways to create a custom connector.
Starting pointWhen it fits
From blank in the wizardSmall APIs, learning, or when no definition exists
Import an OpenAPI definitionThe API vendor publishes one, as Parcelwise did
Import a Postman collectionThe team already tests the API in Postman
From Azure API Management or Azure FunctionsThe API is the organization's own, hosted in Azure
pac connector commandsDefinitions kept in source control and deployed by script

Parcelwise published an OpenAPI definition, but it was large and written for developers rather than makers. Signe advised against importing it whole. A connector should expose the few operations makers need, with friendly names and descriptions, not every endpoint the vendor offers. Wiremu started from the vendor's definition and cut it down to four operations: Create shipment, Get shipment, Get tracking events, and a webhook trigger for When a shipment is delivered.

The OpenAPI definition

Custom connectors are described with the OpenAPI 2.0 format, also known as Swagger. A definition written in a newer OpenAPI version may need to be converted before import; Wiremu checked Microsoft's current guidance rather than assuming. The definition lists paths and operations, and for each operation an operationId, parameters, a request body schema and response schemas. Microsoft adds extensions, properties starting with x-ms-, that control how the connector looks and behaves in the designers.

Part of the Parcelwise connector definition, simplified. Parcelwise is fictional.
"/shipments": {
  "post": {
    "operationId": "CreateShipment",
    "summary": "Create shipment",
    "description": "Books a courier pickup for a sealed transcript and returns the tracking number.",
    "parameters": [
      {
        "name": "body", "in": "body", "required": true,
        "schema": {
          "type": "object",
          "required": ["recipientName", "street", "city", "postalCode"],
          "properties": {
            "recipientName": { "type": "string", "x-ms-summary": "Recipient name" },
            "street":        { "type": "string", "x-ms-summary": "Street address" },
            "city":          { "type": "string", "x-ms-summary": "City" },
            "postalCode":    { "type": "string", "x-ms-summary": "Postal code" },
            "reference":     { "type": "string", "x-ms-summary": "Reference",
                               "x-ms-visibility": "advanced" }
          }
        }
      }
    ],
    "responses": {
      "201": {
        "description": "Shipment created",
        "schema": { "$ref": "#/definitions/Shipment" }
      }
    }
  }
}
Common Microsoft extensions in connector definitions.
ExtensionEffect in the designers
x-ms-summaryThe friendly label shown for a parameter or property
x-ms-visibilityimportant (always shown), advanced (under a show-more link) or internal (hidden)
x-ms-dynamic-valuesFills a drop-down from another operation, such as a list of service levels
x-ms-dynamic-schemaBuilds the fields of a body or response from another operation at design time
x-ms-triggerMarks an operation as a trigger, batch or single
x-ms-notification-urlMarks the parameter that receives the callback URL in a webhook trigger

The summary and description fields are what makers read. Signe's rule was that every operation, parameter and property a maker could see had to have a summary in plain words, and every operation a description of one sentence. A field labelled "postal_cd" or an operation named "post_v2_shipments" would generate support questions for years.

Triggers

Connectors can start flows in two ways. A polling trigger is an operation the platform calls on a schedule, asking whether anything new has happened since the last check, and it uses a state value the API returns to remember where it stopped. A webhook trigger registers a callback URL with the API, which then calls back when something happens, and unregisters it when the flow is turned off. Parcelwise supported webhooks, so Wiremu defined When a shipment is delivered as a webhook trigger: the subscribe operation sent the callback URL, marked with x-ms-notification-url, and the definition included a delete operation that the platform calls to unsubscribe. A flow could then set the transcript request to Sent the moment the courier confirmed delivery.

Response schemas and dynamic values

The response schema matters as much as the request. When a flow calls Create shipment, the designer offers the response's properties as dynamic content for later steps: the tracking number, the estimated delivery date, the label URL. If the response schema is missing or vague, makers see a single "Body" value and have to parse JSON themselves, which is exactly the work a connector should save them. Wiremu wrote a Shipment definition with each property typed and summarized, and referenced it from every operation that returned a shipment, so the same names appeared everywhere.

Parcelwise offered several service levels, such as standard, express and signature required, and the list could change. Rather than hard-coding the choices, Wiremu added an operation, Get service levels, marked with x-ms-visibility set to internal so makers never saw it as an action, and used x-ms-dynamic-values on the service level parameter of Create shipment to call it. In the designer, makers saw a drop-down filled with Parcelwise's current service levels and their friendly names, while the connector sent the codes the API expected.

Connectors in agents

Custom connectors are not only for apps and flows. In Copilot Studio, a connector's actions can be added to an agent as tools, and the agent decides when to call them from the descriptions it reads. That made Signe's rule about descriptions more important still: an agent chooses actions largely from their names and descriptions, so a vague description leads to wrong or missed calls. Maribeth asked whether the Registrar Helper agent could tell students where their courier transcript was. The team agreed it could, through Get shipment with the request number, but only after the agent's authentication and the connector's data were reviewed, and only for the student's own requests. That work was left as a plan for the new year.

Versioning a connector

Like a custom API, a connector is a contract with everything that uses it. Adding an optional parameter or a new operation is safe. Removing an operation, renaming a parameter or changing an operation ID breaks flows that use them, sometimes only when they next run. Microsoft's extensions include a way to mark an operation as deprecated, which hides it from new use in the designers while existing flows continue to work, so the safe pattern is to add a new operation, mark the old one deprecated, move flows across, and remove the old one later.

Wiremu kept the connector's definition, its icon and its settings in the repository under a connectors folder beside the solution source, and updated the connector in his developer environment with pac connector commands from a script. Changes reached test and production only through the solution, as with everything else.

Downloading and updating a custom connector with the Power Platform CLI. Check the CLI help for the current option names.
pac connector download --connector-id <connector-id> --outputDirectory ./connectors/parcelwise
pac connector update --settings-file ./connectors/parcelwise/settings.json --api-definition-file ./connectors/parcelwise/apiDefinition.json --api-properties-file ./connectors/parcelwise/apiProperties.json --solution-unique-name RegistrarTranscripts

The apiProperties file holds the connector's security settings and policies, and the apiDefinition file holds the OpenAPI document. Keeping both in source control meant that every change to authentication or policies was reviewed in a pull request, just like code.

Testing in the wizard

The wizard has a Test page where a developer creates a connection and calls each operation with sample values. Wiremu used a Parcelwise sandbox account, which the vendor offered for development, so no parcels were booked by accident. Testing showed one problem straight away: Parcelwise returned dates as Unix timestamps in seconds, which Power Automate showed as large integers. Changing the response schema did not help, because the data itself was a number. Lesson 8 covers how a little connector code converted them.

Solutions, sharing and governance

Custom connectors can be created inside solutions, and at Lumenvale they always were. A solution-aware connector moves between environments with the apps and flows that use it, and connection references let flows in the solution refer to a connection that is set once per environment during deployment. The Parcelwise connector went into the Registrar Transcripts solution with the flows that used it.

Custom connectors are governed by data policies like any other connector. Rupert's Registrar and finance policy, an allow-list described in MSBA-253, blocked custom connectors by default, and he added Parcelwise only after reviewing the definition, its host and its authentication. Data policies can classify custom connectors by host URL pattern, so the rule allowed connectors pointing at the Parcelwise API host and nothing else.

Worked problem

Reviewing the Parcelwise connector before release

Rupert asked Signe to review the connector against Lumenvale's checklist before he changed the data policy. What did she check?

Show solution
  1. Scope: four operations, each needed by a named flow or app; the vendor's other endpoints left out.
  2. Naming: every visible operation, parameter and property has a plain summary; operation IDs are stable because flows refer to them.
  3. Security: the connection uses the authentication covered in lesson 7, with no secrets in the definition.
  4. Data: only the recipient name, address and a reference number leave the college; student numbers are not sent, so the reference uses the request number.
  5. Lifecycle: the connector is in the Registrar Transcripts solution, the definition is in the repository, and changes go through pull requests.

Answer: The connector passed after one change: the reference field had been populated with the student number, and Signe asked for the request number instead.

A connector or an HTTP action?

Power Automate has an HTTP action that can call any REST API directly, and Wiremu wondered why a connector was worth the effort for four operations. Signe gave three reasons. First, a connector is reusable: the second and third flows that call Parcelwise get the same tested operations, the same names and the same authentication, rather than copies of a hand-built request that differ in small ways. Second, a connector is governable: data policies can allow or block it by name and host, while an HTTP action can call anything unless an administrator uses endpoint filtering, which Rupert had done only for the finance environments. Third, a connector separates the credentials from the flow. A flow with an HTTP action often ends up holding a key in a variable or an action setting, where anyone who can edit the flow can read it; a connection keeps it out of the flow definition.

The HTTP action still had its place. For a one-off call to an API used once, in a flow owned by a developer, building a connector was more ceremony than value. But anything that more than one flow or app would call, or that makers outside central IT would use, got a connector. Both options use premium licensing in Power Automate, so cost was not a reason to choose one over the other.

Certification

Wiremu asked whether the Parcelwise connector could be published for everyone. Microsoft runs a certification program for connectors that should be available to all customers. There are two routes. A verified publisher owns the API, such as Parcelwise itself, and submits the connector to Microsoft for review. An independent publisher does not own the API but builds a connector for it and submits it through Microsoft's open-source connectors repository on GitHub. Certified connectors go through Microsoft's review of their definition, documentation and behaviour, and then appear in the connector list for every tenant.

For Lumenvale, certification made little sense. The Student Records and LedgerPoint connectors wrapped internal systems that nobody outside the college could use, and certification would publish their shape to the world. For Parcelwise, the right publisher was Parcelwise. Signe suggested sending the cut-down definition to the vendor's developer relations contact as feedback, in case they chose to certify a connector of their own, which would then replace Lumenvale's custom one.

Common mistakes

  • MistakeImporting a vendor's entire OpenAPI definition as the connector.

    InsteadExpose only the operations makers need, with plain names.

  • MistakeLeaving parameters without x-ms-summary labels.

    InsteadGive every visible field a friendly summary and set visibility.

  • MistakeChanging operation IDs after flows use the connector.

    InsteadTreat operation IDs as a stable contract.

  • MistakeCreating the connector outside any solution.

    InsteadCreate it in the solution and use connection references.

  • MistakeCertifying a connector for an internal system.

    InsteadKeep internal connectors custom; certification publishes them to every tenant.

Summary and key terms

  • A custom connector wraps an API as typed actions and triggers for apps, flows and agents.
  • It has general information, security settings, an OpenAPI 2.0 definition, and optional policies and code.
  • Connectors can be created in the wizard, from OpenAPI or Postman, from Azure services, or with pac connector commands.
  • Microsoft extensions such as x-ms-summary, x-ms-visibility and x-ms-trigger shape the maker experience; triggers are polling or webhook.
  • Connectors belong in solutions, are governed by data policies, and can be certified by verified or independent publishers.
Custom connector
An organization-defined wrapper around an API for use in Power Platform.
OpenAPI definition
The description of the API's operations, parameters and responses.
x-ms-visibility
An extension that controls whether a field is important, advanced or internal.
Webhook trigger
A trigger that registers a callback URL with the API to be notified of events.
Polling trigger
A trigger that asks the API on a schedule whether anything new has happened.
Independent publisher
A connector author who does not own the API and submits through the open-source repository.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Which OpenAPI version do custom connectors use?

    Show answer

    OpenAPI 2.0.

  2. What does x-ms-visibility "internal" do?

    Show answer

    Hides the field from makers.

  3. Who is the natural publisher of a certified Parcelwise connector?

    Show answer

    Parcelwise, as a verified publisher.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz