Skip to main content

managed_instances

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

Overview

Namemanaged_instances
TypeResource
Idazure.sql.managed_instances

Fields

The following fields are returned by SELECT queries:

Successfully retrieved the specified managed instance.

NameDatatypeDescription
identityobjectThe Azure Active Directory identity of the managed instance.
locationstringResource location.
propertiesobjectResource properties.
skuobjectAn ARM Resource SKU.
tagsobjectResource tags.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresourceGroupName, managedInstanceName, subscriptionId$expandGets a managed instance.
list_by_resource_groupselectresourceGroupName, subscriptionId$expandGets a list of managed instances in a resource group.
listselectsubscriptionId$expandGets a list of all managed instances in the subscription.
create_or_updateinsertresourceGroupName, managedInstanceName, subscriptionId, data__locationCreates or updates a managed instance.
updateupdateresourceGroupName, managedInstanceName, subscriptionIdUpdates a managed instance.
deletedeleteresourceGroupName, managedInstanceName, subscriptionIdDeletes a managed instance.
failoverexecresourceGroupName, managedInstanceName, subscriptionIdreplicaTypeFailovers a managed instance.
refresh_statusexecresourceGroupName, managedInstanceName, subscriptionIdRefresh external governance enablement status.
startexecresourceGroupName, managedInstanceName, subscriptionIdStarts the managed instance.
stopexecresourceGroupName, managedInstanceName, subscriptionIdStops the managed 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
managedInstanceNamestringThe name of the managed instance.
resourceGroupNamestringThe name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
subscriptionIdstringThe subscription ID that identifies an Azure subscription.
$expandstringThe child resources to include in the response.
replicaTypestringThe type of replica to be failed over.

SELECT examples

Gets a managed instance.

SELECT
identity,
location,
properties,
sku,
tags
FROM azure.sql.managed_instances
WHERE resourceGroupName = '{{ resourceGroupName }}' -- required
AND managedInstanceName = '{{ managedInstanceName }}' -- required
AND subscriptionId = '{{ subscriptionId }}' -- required
AND $expand = '{{ $expand }}'
;

INSERT examples

Creates or updates a managed instance.

INSERT INTO azure.sql.managed_instances (
data__location,
data__tags,
data__identity,
data__sku,
data__properties,
resourceGroupName,
managedInstanceName,
subscriptionId
)
SELECT
'{{ location }}' /* required */,
'{{ tags }}',
'{{ identity }}',
'{{ sku }}',
'{{ properties }}',
'{{ resourceGroupName }}',
'{{ managedInstanceName }}',
'{{ subscriptionId }}'
RETURNING
identity,
location,
properties,
sku,
tags
;

UPDATE examples

Updates a managed instance.

UPDATE azure.sql.managed_instances
SET
data__sku = '{{ sku }}',
data__identity = '{{ identity }}',
data__properties = '{{ properties }}',
data__tags = '{{ tags }}'
WHERE
resourceGroupName = '{{ resourceGroupName }}' --required
AND managedInstanceName = '{{ managedInstanceName }}' --required
AND subscriptionId = '{{ subscriptionId }}' --required
RETURNING
identity,
location,
properties,
sku,
tags;

DELETE examples

Deletes a managed instance.

DELETE FROM azure.sql.managed_instances
WHERE resourceGroupName = '{{ resourceGroupName }}' --required
AND managedInstanceName = '{{ managedInstanceName }}' --required
AND subscriptionId = '{{ subscriptionId }}' --required
;

Lifecycle Methods

Failovers a managed instance.

EXEC azure.sql.managed_instances.failover 
@resourceGroupName='{{ resourceGroupName }}' --required,
@managedInstanceName='{{ managedInstanceName }}' --required,
@subscriptionId='{{ subscriptionId }}' --required,
@replicaType='{{ replicaType }}'
;