scripts
Creates, updates, deletes, gets or lists a scripts resource.
Overview
| Name | scripts |
| Type | Resource |
| Id | azure.kusto.scripts |
Fields
The following fields are returned by SELECT queries:
- check_name_availability
- get
- list_by_database
| Name | Datatype | Description |
|---|---|---|
name | string | The name that was checked. |
message | string | Message indicating an unavailable name due to a conflict, or a description of the naming rules that are violated. |
nameAvailable | boolean | Specifies a Boolean value that indicates if the name is available. |
reason | string | Message providing the reason why the given name is invalid. Known values are: "Invalid" and "AlreadyExists". (Invalid, AlreadyExists) |
| 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. |
continueOnErrors | boolean | Flag that indicates whether to continue if one of the command fails. |
forceUpdateTag | string | A unique string. If changed the script will be applied again. |
managedIdentityResourceId | string | The resource identifier of the managed identity to be used. When provided, the managed identity will be used to read the script content from the scriptUrl. |
principalPermissionsAction | string | Indicates if the permissions for the script caller are kept following completion of the script. Known values are: "RetainPermissionOnScriptCompletion" and "RemovePermissionOnScriptCompletion". (RetainPermissionOnScriptCompletion, RemovePermissionOnScriptCompletion) |
provisioningState | string | The provisioned state of the resource. Known values are: "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", and "Canceled". (Running, Creating, Deleting, Succeeded, Failed, Moving, Canceled) |
scriptContent | string | The script content. This property should be used when the script is provide inline and not through file in a SA. Must not be used together with scriptUrl and scriptUrlSasToken properties. |
scriptLevel | string | Differentiates between the type of script commands included - Database or Cluster. The default is Database. Known values are: "Database" and "Cluster". (Database, Cluster) |
scriptUrl | string | The url to the KQL script blob file. Must not be used together with scriptContent property. |
scriptUrlSasToken | string | The SaS token that provide read access to the file which contain the script. Must be provided when using scriptUrl property. |
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. |
continueOnErrors | boolean | Flag that indicates whether to continue if one of the command fails. |
forceUpdateTag | string | A unique string. If changed the script will be applied again. |
managedIdentityResourceId | string | The resource identifier of the managed identity to be used. When provided, the managed identity will be used to read the script content from the scriptUrl. |
principalPermissionsAction | string | Indicates if the permissions for the script caller are kept following completion of the script. Known values are: "RetainPermissionOnScriptCompletion" and "RemovePermissionOnScriptCompletion". (RetainPermissionOnScriptCompletion, RemovePermissionOnScriptCompletion) |
provisioningState | string | The provisioned state of the resource. Known values are: "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", and "Canceled". (Running, Creating, Deleting, Succeeded, Failed, Moving, Canceled) |
scriptContent | string | The script content. This property should be used when the script is provide inline and not through file in a SA. Must not be used together with scriptUrl and scriptUrlSasToken properties. |
scriptLevel | string | Differentiates between the type of script commands included - Database or Cluster. The default is Database. Known values are: "Database" and "Cluster". (Database, Cluster) |
scriptUrl | string | The url to the KQL script blob file. Must not be used together with scriptContent property. |
scriptUrlSasToken | string | The SaS token that provide read access to the file which contain the script. Must be provided when using scriptUrl property. |
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 |
|---|---|---|---|---|
check_name_availability | select | resource_group_name, cluster_name, database_name, subscription_id | Checks that the script name is valid and is not already in use. | |
get | select | resource_group_name, cluster_name, database_name, script_name, subscription_id | Gets a Kusto cluster database script. | |
list_by_database | select | resource_group_name, cluster_name, database_name, subscription_id | Returns the list of database scripts for given database. | |
create_or_update | insert | resource_group_name, cluster_name, database_name, script_name, subscription_id | Creates a Kusto database script. | |
update | update | resource_group_name, cluster_name, database_name, script_name, subscription_id | Updates a database script. | |
create_or_update | replace | resource_group_name, cluster_name, database_name, script_name, subscription_id | Creates a Kusto database script. | |
delete | delete | resource_group_name, cluster_name, database_name, script_name, subscription_id | Deletes a Kusto database script. |
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 |
|---|---|---|
cluster_name | string | The name of the Kusto cluster. Required. |
database_name | string | The name of the database in the Kusto cluster. Required. |
resource_group_name | string | The name of the resource group. The name is case insensitive. Required. |
script_name | string | The name of the Kusto database script. Required. |
subscription_id | string |
SELECT examples
- check_name_availability
- get
- list_by_database
Checks that the script name is valid and is not already in use.
SELECT
name,
message,
nameAvailable,
reason
FROM azure.kusto.scripts
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND cluster_name = '{{ cluster_name }}' -- required
AND database_name = '{{ database_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
Gets a Kusto cluster database script.
SELECT
id,
name,
continueOnErrors,
forceUpdateTag,
managedIdentityResourceId,
principalPermissionsAction,
provisioningState,
scriptContent,
scriptLevel,
scriptUrl,
scriptUrlSasToken,
systemData,
type
FROM azure.kusto.scripts
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND cluster_name = '{{ cluster_name }}' -- required
AND database_name = '{{ database_name }}' -- required
AND script_name = '{{ script_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
Returns the list of database scripts for given database.
SELECT
id,
name,
continueOnErrors,
forceUpdateTag,
managedIdentityResourceId,
principalPermissionsAction,
provisioningState,
scriptContent,
scriptLevel,
scriptUrl,
scriptUrlSasToken,
systemData,
type
FROM azure.kusto.scripts
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND cluster_name = '{{ cluster_name }}' -- required
AND database_name = '{{ database_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
INSERT examples
- create_or_update
- Manifest
Creates a Kusto database script.
INSERT INTO azure.kusto.scripts (
properties,
resource_group_name,
cluster_name,
database_name,
script_name,
subscription_id
)
SELECT
'{{ properties }}',
'{{ resource_group_name }}',
'{{ cluster_name }}',
'{{ database_name }}',
'{{ script_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
properties,
systemData,
type
;
# Description fields are for documentation purposes
- name: scripts
props:
- name: resource_group_name
value: "{{ resource_group_name }}"
description: Required parameter for the scripts resource.
- name: cluster_name
value: "{{ cluster_name }}"
description: Required parameter for the scripts resource.
- name: database_name
value: "{{ database_name }}"
description: Required parameter for the scripts resource.
- name: script_name
value: "{{ script_name }}"
description: Required parameter for the scripts resource.
- name: subscription_id
value: "{{ subscription_id }}"
description: Required parameter for the scripts resource.
- name: properties
description: |
The database script.
value:
scriptUrl: "{{ scriptUrl }}"
scriptUrlSasToken: "{{ scriptUrlSasToken }}"
scriptContent: "{{ scriptContent }}"
forceUpdateTag: "{{ forceUpdateTag }}"
continueOnErrors: {{ continueOnErrors }}
provisioningState: "{{ provisioningState }}"
scriptLevel: "{{ scriptLevel }}"
principalPermissionsAction: "{{ principalPermissionsAction }}"
managedIdentityResourceId: "{{ managedIdentityResourceId }}"
UPDATE examples
- update
Updates a database script.
UPDATE azure.kusto.scripts
SET
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND cluster_name = '{{ cluster_name }}' --required
AND database_name = '{{ database_name }}' --required
AND script_name = '{{ script_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
properties,
systemData,
type;
REPLACE examples
- create_or_update
Creates a Kusto database script.
REPLACE azure.kusto.scripts
SET
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND cluster_name = '{{ cluster_name }}' --required
AND database_name = '{{ database_name }}' --required
AND script_name = '{{ script_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
properties,
systemData,
type;
DELETE examples
- delete
Deletes a Kusto database script.
DELETE FROM azure.kusto.scripts
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND cluster_name = '{{ cluster_name }}' --required
AND database_name = '{{ database_name }}' --required
AND script_name = '{{ script_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;