Skip to main content

targets

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

Overview

Nametargets
TypeResource
Idazure.database_watcher.targets

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}. # pylint: disable=line-too-long
namestringThe name of the resource.
connectionServerNamestringThe server name to use in the connection string when connecting to a target. Port number and instance name must be specified separately. Required.
provisioningStatestringThe provisioning state of the resource. Known values are: "Succeeded", "Failed", and "Canceled". (Succeeded, Failed, Canceled)
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
targetAuthenticationTypestringThe type of authentication to use when connecting to a target. Required. Known values are: "Aad" and "Sql". (Aad, Sql)
targetTypestringDiscriminator property for TargetProperties. Required. Default value is None.
targetVaultobjectTo use SQL authentication when connecting to targets, specify the vault where the login name and password secrets are stored.
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, watcher_name, target_name, subscription_idGet a Target.
list_by_watcherselectresource_group_name, watcher_name, subscription_idList Target resources by Watcher.
create_or_updateinsertresource_group_name, watcher_name, target_name, subscription_idCreate a Target.
create_or_updatereplaceresource_group_name, watcher_name, target_name, subscription_idCreate a Target.
deletedeleteresource_group_name, watcher_name, target_name, subscription_idDelete a Target.

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.
subscription_idstring
target_namestringThe target resource name. Required.
watcher_namestringThe database watcher name. Required.

SELECT examples

Get a Target.

SELECT
id,
name,
connectionServerName,
provisioningState,
systemData,
targetAuthenticationType,
targetType,
targetVault,
type
FROM azure.database_watcher.targets
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND watcher_name = '{{ watcher_name }}' -- required
AND target_name = '{{ target_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

INSERT examples

Create a Target.

INSERT INTO azure.database_watcher.targets (
properties,
resource_group_name,
watcher_name,
target_name,
subscription_id
)
SELECT
'{{ properties }}',
'{{ resource_group_name }}',
'{{ watcher_name }}',
'{{ target_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
properties,
systemData,
type
;

REPLACE examples

Create a Target.

REPLACE azure.database_watcher.targets
SET
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND watcher_name = '{{ watcher_name }}' --required
AND target_name = '{{ target_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
properties,
systemData,
type;

DELETE examples

Delete a Target.

DELETE FROM azure.database_watcher.targets
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND watcher_name = '{{ watcher_name }}' --required
AND target_name = '{{ target_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;