Policies - Create Or Update
Create or replace an existing policy.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}?api-version=2018-09-15
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
lab
|
path | True |
string |
The name of the lab. |
name
|
path | True |
string |
The name of the policy. |
policy
|
path | True |
string |
The name of the policy set. |
resource
|
path | True |
string |
The name of the resource group. |
subscription
|
path | True |
string |
The subscription ID. |
api-version
|
query | True |
string |
Client API version. |
Request Body
Name | Type | Description |
---|---|---|
location |
string |
The location of the resource. |
properties.description |
string |
The description of the policy. |
properties.evaluatorType |
The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). |
|
properties.factData |
string |
The fact data of the policy. |
properties.factName |
The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. |
|
properties.status |
The status of the policy. |
|
properties.threshold |
string |
The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy). |
tags |
object |
The tags of the resource. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
OK |
|
201 Created |
Created |
|
Other Status Codes |
BadRequest |
Security
azure_auth
OAuth2 Implicit Grant
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name | Description |
---|---|
user_impersonation | Access Microsoft Azure |
Examples
Policies_CreateOrUpdate
Sample Request
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{policyName}?api-version=2018-09-15
{
"location": "{location}",
"tags": {
"tagName1": "tagValue1"
},
"properties": {
"description": "{policyDescription}",
"status": "{policyStatus}",
"factName": "{policyFactName}",
"factData": "{policyFactData}",
"threshold": "{policyThreshold}",
"evaluatorType": "{policyEvaluatorType}"
}
}
Sample Response
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{policyName}",
"name": "{labName}",
"type": "Microsoft.DevTestLab/labs/policies",
"location": "{location}",
"properties": {
"description": "{policyDescription}",
"status": "{policyStatus}",
"factName": "{policyFactName}",
"factData": "{policyFactData}",
"threshold": "{policyThreshold}",
"evaluatorType": "{policyEvaluatorType}",
"createdDate": "2018-10-01T18:40:48.1739018-07:00",
"provisioningState": "Succeeded",
"uniqueIdentifier": "{uniqueIdentifier}"
}
}
{
"id": "/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{policyName}",
"name": "{labName}",
"type": "Microsoft.DevTestLab/labs/policySets/policies",
"location": "{location}",
"properties": {
"description": "{policyDescription}",
"status": "{policyStatus}",
"factName": "{policyFactName}",
"factData": "{policyFactData}",
"threshold": "{policyThreshold}",
"evaluatorType": "{policyEvaluatorType}",
"createdDate": "2018-10-01T18:40:48.1739018-07:00",
"provisioningState": "Succeeded",
"uniqueIdentifier": "{uniqueIdentifier}"
}
}
Definitions
Name | Description |
---|---|
Cloud |
Error from a REST request. |
Cloud |
Body of an error from a REST request. |
Policy |
A Policy. |
Policy |
The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). |
Policy |
The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. |
Policy |
The status of the policy. |
CloudError
Error from a REST request.
Name | Type | Description |
---|---|---|
error |
The cloud error that occurred |
CloudErrorBody
Body of an error from a REST request.
Name | Type | Description |
---|---|---|
code |
string |
The error code. |
details |
Inner errors. |
|
message |
string |
The error message. |
target |
string |
The error target. |
Policy
A Policy.
Name | Type | Description |
---|---|---|
id |
string |
The identifier of the resource. |
location |
string |
The location of the resource. |
name |
string |
The name of the resource. |
properties.createdDate |
string |
The creation date of the policy. |
properties.description |
string |
The description of the policy. |
properties.evaluatorType |
The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). |
|
properties.factData |
string |
The fact data of the policy. |
properties.factName |
The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. |
|
properties.provisioningState |
string |
The provisioning status of the resource. |
properties.status |
The status of the policy. |
|
properties.threshold |
string |
The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy). |
properties.uniqueIdentifier |
string |
The unique immutable identifier of a resource (Guid). |
tags |
object |
The tags of the resource. |
type |
string |
The type of the resource. |
PolicyEvaluatorType
The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy).
Name | Type | Description |
---|---|---|
AllowedValuesPolicy |
string |
|
MaxValuePolicy |
string |
PolicyFactName
The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc.
Name | Type | Description |
---|---|---|
EnvironmentTemplate |
string |
|
GalleryImage |
string |
|
LabPremiumVmCount |
string |
|
LabTargetCost |
string |
|
LabVmCount |
string |
|
LabVmSize |
string |
|
ScheduleEditPermission |
string |
|
UserOwnedLabPremiumVmCount |
string |
|
UserOwnedLabVmCount |
string |
|
UserOwnedLabVmCountInSubnet |
string |
PolicyStatus
The status of the policy.
Name | Type | Description |
---|---|---|
Disabled |
string |
|
Enabled |
string |