Skip to main content

workspace_subscription

Creates, updates, deletes, gets or lists a workspace_subscription resource.

Overview

Nameworkspace_subscription
TypeResource
Idazure.api_management.workspace_subscription

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
allowTracingbooleanDetermines whether tracing is enabled.
createdDatestring (date-time)Subscription creation date. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard.
displayNamestringThe name of the subscription, or null if the subscription has no name.
endDatestring (date-time)Date when subscription was cancelled or expired. The setting is for audit purposes only and the subscription is not automatically cancelled. The subscription lifecycle can be managed by using the state property. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard.
expirationDatestring (date-time)Subscription expiration date. The setting is for audit purposes only and the subscription is not automatically expired. The subscription lifecycle can be managed by using the state property. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard.
notificationDatestring (date-time)Upcoming subscription expiration notification date. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard.
ownerIdstringThe user resource identifier of the subscription owner. The value is a valid relative URL in the format of /users/{userId} where {userId} is a user identifier.
primaryKeystringSubscription primary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value.
scopestringScope like /products/{productId} or /apis or /apis/{apiId}. Required.
secondaryKeystringSubscription secondary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value.
startDatestring (date-time)Subscription activation date. The setting is for audit purposes only and the subscription is not automatically activated. The subscription lifecycle can be managed by using the state property. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard.
statestringSubscription state. Possible states are * active – the subscription is active, * suspended – the subscription is blocked, and the subscriber cannot call any APIs of the product, * submitted – the subscription request has been made by the developer, but has not yet been approved or rejected, * rejected – the subscription request has been denied by an administrator, * cancelled – the subscription has been cancelled by the developer or administrator, * expired – the subscription reached its expiration date and was deactivated. Required. Known values are: "suspended", "active", "expired", "submitted", "rejected", and "cancelled". (suspended, active, expired, submitted, rejected, cancelled)
stateCommentstringOptional subscription comment added by an administrator when the state is changed to the 'rejected'.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, service_name, workspace_id, sid, subscription_idGets the specified Subscription entity.
listselectresource_group_name, service_name, workspace_id, subscription_id$filter, $top, $skipLists all subscriptions of the workspace in an API Management service instance.
create_or_updateinsertresource_group_name, service_name, workspace_id, sid, subscription_idnotify, appTypeCreates or updates the subscription of specified user to the specified product.
updateupdateresource_group_name, service_name, workspace_id, sid, subscription_idnotify, appTypeUpdates the details of a subscription specified by its identifier.
create_or_updatereplaceresource_group_name, service_name, workspace_id, sid, subscription_idnotify, appTypeCreates or updates the subscription of specified user to the specified product.
deletedeleteresource_group_name, service_name, workspace_id, sid, subscription_idDeletes the specified subscription.
get_entity_tagexecresource_group_name, service_name, workspace_id, sid, subscription_idGets the entity state (Etag) version of the apimanagement subscription specified by its identifier.
list_secretsexecresource_group_name, service_name, workspace_id, sid, subscription_idGets the specified Subscription keys.
regenerate_primary_keyexecresource_group_name, service_name, workspace_id, sid, subscription_idRegenerates primary key of existing subscription of the workspace in an API Management service instance.
regenerate_secondary_keyexecresource_group_name, service_name, workspace_id, sid, subscription_idRegenerates secondary key of existing subscription of the workspace in an API Management service instance.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
resource_group_namestringThe name of the resource group. The name is case insensitive. Required.
service_namestringThe name of the API Management service. Required.
sidstringSubscription entity Identifier. The entity represents the association between a user and a product in API Management. Required.
subscription_idstring
workspace_idstringWorkspace identifier. Must be unique in the current API Management service instance. Required.
$filterstring| Field | Usage | Supported operators | Supported functions ||-------------|-------------|-------------|-------------|| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || displayName | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || stateComment | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || ownerId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || scope | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || userId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || productId | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith || state | filter | eq | || user | expand | | |. Default value is None.
$skipintegerNumber of records to skip. Default value is None.
$topintegerNumber of records to return. Default value is None.
appTypestringDetermines the type of application which send the create user request. Default is legacy publisher portal. Known values are: "portal" and "developerPortal". Default value is None.
notifybooleanNotify change in Subscription State. * If false, do not send any email notification for change of state of subscription * If true, send email notification of change of state of subscription. Default value is None.

SELECT examples

Gets the specified Subscription entity.

SELECT
id,
name,
allowTracing,
createdDate,
displayName,
endDate,
expirationDate,
notificationDate,
ownerId,
primaryKey,
scope,
secondaryKey,
startDate,
state,
stateComment,
systemData,
type
FROM azure.api_management.workspace_subscription
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND service_name = '{{ service_name }}' -- required
AND workspace_id = '{{ workspace_id }}' -- required
AND sid = '{{ sid }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

INSERT examples

Creates or updates the subscription of specified user to the specified product.

INSERT INTO azure.api_management.workspace_subscription (
properties,
resource_group_name,
service_name,
workspace_id,
sid,
subscription_id,
notify,
appType
)
SELECT
'{{ properties }}',
'{{ resource_group_name }}',
'{{ service_name }}',
'{{ workspace_id }}',
'{{ sid }}',
'{{ subscription_id }}',
'{{ notify }}',
'{{ appType }}'
RETURNING
id,
name,
properties,
systemData,
type
;

UPDATE examples

Updates the details of a subscription specified by its identifier.

UPDATE azure.api_management.workspace_subscription
SET
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND service_name = '{{ service_name }}' --required
AND workspace_id = '{{ workspace_id }}' --required
AND sid = '{{ sid }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND notify = {{ notify}}
AND appType = '{{ appType}}'
RETURNING
id,
name,
properties,
systemData,
type;

REPLACE examples

Creates or updates the subscription of specified user to the specified product.

REPLACE azure.api_management.workspace_subscription
SET
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND service_name = '{{ service_name }}' --required
AND workspace_id = '{{ workspace_id }}' --required
AND sid = '{{ sid }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND notify = {{ notify}}
AND appType = '{{ appType}}'
RETURNING
id,
name,
properties,
systemData,
type;

DELETE examples

Deletes the specified subscription.

DELETE FROM azure.api_management.workspace_subscription
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND service_name = '{{ service_name }}' --required
AND workspace_id = '{{ workspace_id }}' --required
AND sid = '{{ sid }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;

Lifecycle Methods

Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier.

EXEC azure.api_management.workspace_subscription.get_entity_tag 
@resource_group_name='{{ resource_group_name }}' --required,
@service_name='{{ service_name }}' --required,
@workspace_id='{{ workspace_id }}' --required,
@sid='{{ sid }}' --required,
@subscription_id='{{ subscription_id }}' --required
;