workspace_subscription
Creates, updates, deletes, gets or lists a workspace_subscription resource.
Overview
| Name | workspace_subscription |
| Type | Resource |
| Id | azure.api_management.workspace_subscription |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
allowTracing | boolean | Determines whether tracing is enabled. |
createdDate | string (date-time) | Subscription creation date. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. |
displayName | string | The name of the subscription, or null if the subscription has no name. |
endDate | string (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. |
expirationDate | string (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. |
notificationDate | string (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. |
ownerId | string | The 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. |
primaryKey | string | Subscription primary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. |
scope | string | Scope like /products/{productId} or /apis or /apis/{apiId}. Required. |
secondaryKey | string | Subscription secondary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. |
startDate | string (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. |
state | string | Subscription 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) |
stateComment | string | Optional subscription comment added by an administrator when the state is changed to the 'rejected'. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
allowTracing | boolean | Determines whether tracing is enabled. |
createdDate | string (date-time) | Subscription creation date. The date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. |
displayName | string | The name of the subscription, or null if the subscription has no name. |
endDate | string (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. |
expirationDate | string (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. |
notificationDate | string (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. |
ownerId | string | The 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. |
primaryKey | string | Subscription primary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. |
scope | string | Scope like /products/{productId} or /apis or /apis/{apiId}. Required. |
secondaryKey | string | Subscription secondary key. This property will not be filled on 'GET' operations! Use '/listSecrets' POST request to get the value. |
startDate | string (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. |
state | string | Subscription 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) |
stateComment | string | Optional subscription comment added by an administrator when the state is changed to the 'rejected'. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | resource_group_name, service_name, workspace_id, sid, subscription_id | Gets the specified Subscription entity. | |
list | select | resource_group_name, service_name, workspace_id, subscription_id | $filter, $top, $skip | Lists all subscriptions of the workspace in an API Management service instance. |
create_or_update | insert | resource_group_name, service_name, workspace_id, sid, subscription_id | notify, appType | Creates or updates the subscription of specified user to the specified product. |
update | update | resource_group_name, service_name, workspace_id, sid, subscription_id | notify, appType | Updates the details of a subscription specified by its identifier. |
create_or_update | replace | resource_group_name, service_name, workspace_id, sid, subscription_id | notify, appType | Creates or updates the subscription of specified user to the specified product. |
delete | delete | resource_group_name, service_name, workspace_id, sid, subscription_id | Deletes the specified subscription. | |
get_entity_tag | exec | resource_group_name, service_name, workspace_id, sid, subscription_id | Gets the entity state (Etag) version of the apimanagement subscription specified by its identifier. | |
list_secrets | exec | resource_group_name, service_name, workspace_id, sid, subscription_id | Gets the specified Subscription keys. | |
regenerate_primary_key | exec | resource_group_name, service_name, workspace_id, sid, subscription_id | Regenerates primary key of existing subscription of the workspace in an API Management service instance. | |
regenerate_secondary_key | exec | resource_group_name, service_name, workspace_id, sid, subscription_id | Regenerates 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.
| Name | Datatype | Description |
|---|---|---|
resource_group_name | string | The name of the resource group. The name is case insensitive. Required. |
service_name | string | The name of the API Management service. Required. |
sid | string | Subscription entity Identifier. The entity represents the association between a user and a product in API Management. Required. |
subscription_id | string | |
workspace_id | string | Workspace identifier. Must be unique in the current API Management service instance. Required. |
$filter | string | | 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. |
$skip | integer | Number of records to skip. Default value is None. |
$top | integer | Number of records to return. Default value is None. |
appType | string | Determines 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. |
notify | boolean | Notify 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
- get
- list
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
;
Lists all subscriptions of the workspace in an API Management service instance.
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 subscription_id = '{{ subscription_id }}' -- required
AND $filter = '{{ $filter }}'
AND $top = '{{ $top }}'
AND $skip = '{{ $skip }}'
;
INSERT examples
- create_or_update
- Manifest
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
;
# Description fields are for documentation purposes
- name: workspace_subscription
props:
- name: resource_group_name
value: "{{ resource_group_name }}"
description: Required parameter for the workspace_subscription resource.
- name: service_name
value: "{{ service_name }}"
description: Required parameter for the workspace_subscription resource.
- name: workspace_id
value: "{{ workspace_id }}"
description: Required parameter for the workspace_subscription resource.
- name: sid
value: "{{ sid }}"
description: Required parameter for the workspace_subscription resource.
- name: subscription_id
value: "{{ subscription_id }}"
description: Required parameter for the workspace_subscription resource.
- name: properties
description: |
Subscription contract properties.
value:
ownerId: "{{ ownerId }}"
scope: "{{ scope }}"
displayName: "{{ displayName }}"
primaryKey: "{{ primaryKey }}"
secondaryKey: "{{ secondaryKey }}"
state: "{{ state }}"
allowTracing: {{ allowTracing }}
- name: notify
value: {{ notify }}
description: Notify 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.
description: Notify 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.
- name: appType
value: "{{ appType }}"
description: Determines 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.
description: Determines 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.
UPDATE examples
- update
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
- create_or_update
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
- delete
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
- get_entity_tag
- list_secrets
- regenerate_primary_key
- regenerate_secondary_key
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
;
Gets the specified Subscription keys.
EXEC azure.api_management.workspace_subscription.list_secrets
@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
;
Regenerates primary key of existing subscription of the workspace in an API Management service instance.
EXEC azure.api_management.workspace_subscription.regenerate_primary_key
@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
;
Regenerates secondary key of existing subscription of the workspace in an API Management service instance.
EXEC azure.api_management.workspace_subscription.regenerate_secondary_key
@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
;