Skip to main content

costs

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

Overview

Namecosts
TypeResource
Idazure.dev_test_labs.costs

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe identifier of the resource.
namestringThe name of the resource.
createdDatestring (date-time)The creation date of the cost.
currencyCodestringThe currency code of the cost.
endDateTimestring (date-time)The end time of the cost data.
labCostDetailsarrayThe lab cost details component of the cost data.
labCostSummaryobjectThe lab cost summary component of the cost data.
locationstringThe location of the resource.
provisioningStatestringThe provisioning status of the resource.
resourceCostsarrayThe resource cost component of the cost data.
startDateTimestring (date-time)The start time of the cost data.
tagsobjectThe tags of the resource.
targetCostobjectThe target cost properties.
typestringThe type of the resource.
uniqueIdentifierstringThe unique immutable identifier of a resource (Guid).

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, lab_name, name, subscription_id$expandGet cost.
create_or_updateinsertresource_group_name, lab_name, name, subscription_idCreate or replace an existing cost.
create_or_updatereplaceresource_group_name, lab_name, name, subscription_idCreate or replace an existing cost.

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
lab_namestringThe name of the lab. Required.
namestringThe name of the cost. Required.
resource_group_namestringThe name of the resource group. Required.
subscription_idstring
$expandstringSpecify the $expand query. Example: 'properties($expand=labCostDetails)'. Default value is None.

SELECT examples

Get cost.

SELECT
id,
name,
createdDate,
currencyCode,
endDateTime,
labCostDetails,
labCostSummary,
location,
provisioningState,
resourceCosts,
startDateTime,
tags,
targetCost,
type,
uniqueIdentifier
FROM azure.dev_test_labs.costs
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND lab_name = '{{ lab_name }}' -- required
AND name = '{{ name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND $expand = '{{ $expand }}'
;

INSERT examples

Create or replace an existing cost.

INSERT INTO azure.dev_test_labs.costs (
location,
tags,
properties,
resource_group_name,
lab_name,
name,
subscription_id
)
SELECT
'{{ location }}',
'{{ tags }}',
'{{ properties }}',
'{{ resource_group_name }}',
'{{ lab_name }}',
'{{ name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
location,
properties,
tags,
type
;

REPLACE examples

Create or replace an existing cost.

REPLACE azure.dev_test_labs.costs
SET
location = '{{ location }}',
tags = '{{ tags }}',
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND lab_name = '{{ lab_name }}' --required
AND name = '{{ name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
location,
properties,
tags,
type;