API Management PowerShell and REST APIs
    • Dark
      Light
    • PDF

    API Management PowerShell and REST APIs

    • Dark
      Light
    • PDF

    Article Summary

    There are various ways to interact with an API Management Instance besides the Azure portal. You can leverage PowerShell scripts ranging from adding a user to importing an API. These scripts are available through GitHub. Furthermore, you can look at the Azure API Management cmdlets page.

    Next to PowerShell, you can opt to use the available API Management REST APIs. These APIs allow you to perform operations on selected entities, such as users, groups, products, and subscriptions (see the API Management REST API reference).

    In the Azure portal, you can within the API Management instance navigate to Management API under Deployment and infrastructure. Here you can choose to enable the Management REST API.

    4(1)

    By enabling the Management REST API, you can interact programmatically with an API Management and its entities. Note that if the Management REST API is not enabled any request to these APIs will fail. You will notice that the base URL is shown in the Management API URL, with the following format: https://{servicename}.management.azure-api.net

    All URLs returned by the API Management REST API are relative to this base URL, and all requests to the REST API must use this base URL template. Furthermore, all operations expect an api-version query parameter with a value in the format of YYYY-MM-DD; for example, 2014-02-14 (current version(latest) is 2019-12-01). When sending a request to the REST API endpoint, you also will have to add an Authorization header with a valid shared access token. This token can be obtained from the portal when you click Generate button (see screenshot). The result of the generation is something like: SharedAccessSignature integration&202010260859&YfglSdN0+JPHaHvFfL27LPsAkgrv2pFpQCUISLqTm3fsvMK7h0i1ARGt0DY3T+rqwjXiKdVUPQvLDCyeFLpu8g==

    Tip you can find a .NET REST API example on GitHub.

    Lastly, there is also a Management API Setting, which provides you with an RBAC capability to prevent users with read-only permissions from accessing service secrets. The portal will give you the following warning: Turning this option on will disable management API versions preceding 2019-12-01.


    Was this article helpful?