Skip to main content

labs

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

Overview

Namelabs
TypeResource
Idazure.dev_test_labs.labs

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe identifier of the resource.
namestringThe name of the resource.
locationstringThe location of the resource.
propertiesobjectThe properties of the resource.
tagsobjectThe tags of the resource.
typestringThe type of the resource.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectsubscriptionId, resourceGroupName, name$expand, api-versionGet lab.
list_by_resource_groupselectsubscriptionId, resourceGroupName$expand, $filter, $top, $orderby, api-versionList labs in a resource group.
list_by_subscriptionselectsubscriptionId$expand, $filter, $top, $orderby, api-versionList labs in a subscription.
create_or_updateinsertsubscriptionId, resourceGroupName, nameapi-versionCreate or replace an existing lab. This operation can take a while to complete.
updateupdatesubscriptionId, resourceGroupName, nameapi-versionAllows modifying tags of labs. All other properties will be ignored.
deletedeletesubscriptionId, resourceGroupName, nameapi-versionDelete lab. This operation can take a while to complete.
claim_any_vmexecsubscriptionId, resourceGroupName, nameapi-versionClaim a random claimable virtual machine in the lab. This operation can take a while to complete.
export_resource_usageexecsubscriptionId, resourceGroupName, nameapi-versionExports the lab resource usage into a storage account This operation can take a while to complete.
generate_upload_uriexecsubscriptionId, resourceGroupName, nameapi-versionGenerate a URI for uploading custom disk images to a Lab.
import_virtual_machineexecsubscriptionId, resourceGroupName, nameapi-versionImport a virtual machine into a different lab. This operation can take a while to complete.

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
namestringThe name of the lab.
resourceGroupNamestringThe name of the resource group.
subscriptionIdstringThe subscription ID.
$expandstringSpecify the $expand query. Example: 'properties($select=defaultStorageAccount)'
$filterstringThe filter to apply to the operation. Example: '$filter=contains(name,'myName')
$orderbystringThe ordering expression for the results, using OData notation. Example: '$orderby=name desc'
$topinteger (int32)The maximum number of resources to return from the operation. Example: '$top=10'
api-versionstringClient API version.

SELECT examples

Get lab.

SELECT
id,
name,
location,
properties,
tags,
type
FROM azure.dev_test_labs.labs
WHERE subscriptionId = '{{ subscriptionId }}' -- required
AND resourceGroupName = '{{ resourceGroupName }}' -- required
AND name = '{{ name }}' -- required
AND $expand = '{{ $expand }}'
AND api-version = '{{ api-version }}'
;

INSERT examples

Create or replace an existing lab. This operation can take a while to complete.

INSERT INTO azure.dev_test_labs.labs (
data__location,
data__tags,
data__properties,
subscriptionId,
resourceGroupName,
name,
api-version
)
SELECT
'{{ location }}',
'{{ tags }}',
'{{ properties }}',
'{{ subscriptionId }}',
'{{ resourceGroupName }}',
'{{ name }}',
'{{ api-version }}'
RETURNING
id,
name,
location,
properties,
tags,
type
;

UPDATE examples

Allows modifying tags of labs. All other properties will be ignored.

UPDATE azure.dev_test_labs.labs
SET
data__tags = '{{ tags }}'
WHERE
subscriptionId = '{{ subscriptionId }}' --required
AND resourceGroupName = '{{ resourceGroupName }}' --required
AND name = '{{ name }}' --required
AND api-version = '{{ api-version}}'
RETURNING
id,
name,
location,
properties,
tags,
type;

DELETE examples

Delete lab. This operation can take a while to complete.

DELETE FROM azure.dev_test_labs.labs
WHERE subscriptionId = '{{ subscriptionId }}' --required
AND resourceGroupName = '{{ resourceGroupName }}' --required
AND name = '{{ name }}' --required
AND api-version = '{{ api-version }}'
;

Lifecycle Methods

Claim a random claimable virtual machine in the lab. This operation can take a while to complete.

EXEC azure.dev_test_labs.labs.claim_any_vm 
@subscriptionId='{{ subscriptionId }}' --required,
@resourceGroupName='{{ resourceGroupName }}' --required,
@name='{{ name }}' --required,
@api-version='{{ api-version }}'
;