Share via


Policies - List

List policies in a given policy set.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies?api-version=2018-09-15
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies?$expand={$expand}&$filter={$filter}&$top={$top}&$orderby={$orderby}&api-version=2018-09-15

URI Parameters

Name In Required Type Description
labName
path True

string

The name of the lab.

policySetName
path True

string

The name of the policy set.

resourceGroupName
path True

string

The name of the resource group.

subscriptionId
path True

string

The subscription ID.

api-version
query True

string

Client API version.

$expand
query

string

Specify the $expand query. Example: 'properties($select=description)'

$filter
query

string

The filter to apply to the operation. Example: '$filter=contains(name,'myName')

$orderby
query

string

The ordering expression for the results, using OData notation. Example: '$orderby=name desc'

$top
query

integer (int32)

The maximum number of resources to return from the operation. Example: '$top=10'

Responses

Name Type Description
200 OK

PolicyList

OK

Other Status Codes

CloudError

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_List

Sample request

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/resourceGroupName/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies?api-version=2018-09-15

Sample response

{
  "value": [
    {
      "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}",
      "tags": {
        "tagName1": "tagValue1"
      }
    }
  ]
}

Definitions

Name Description
CloudError

Error from a REST request.

CloudErrorBody

Body of an error from a REST request.

Policy

A Policy.

PolicyEvaluatorType

The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy).

PolicyFactName

The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc.

PolicyList

The response of a list operation.

PolicyStatus

The status of the policy.

CloudError

Error from a REST request.

Name Type Description
error

CloudErrorBody

The cloud error that occurred

CloudErrorBody

Body of an error from a REST request.

Name Type Description
code

string

The error code.

details

CloudErrorBody[]

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 (date-time)

The creation date of the policy.

properties.description

string

The description of the policy.

properties.evaluatorType

PolicyEvaluatorType

The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy).

properties.factData

string

The fact data of the policy.

properties.factName

PolicyFactName

The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc.

properties.provisioningState

string

The provisioning status of the resource.

properties.status

PolicyStatus

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).

Value Description
AllowedValuesPolicy
MaxValuePolicy

PolicyFactName

The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc.

Value Description
EnvironmentTemplate
GalleryImage
LabPremiumVmCount
LabTargetCost
LabVmCount
LabVmSize
ScheduleEditPermission
UserOwnedLabPremiumVmCount
UserOwnedLabVmCount
UserOwnedLabVmCountInSubnet

PolicyList

The response of a list operation.

Name Type Description
nextLink

string

Link for next set of results.

value

Policy[]

Results of the list operation.

PolicyStatus

The status of the policy.

Value Description
Disabled
Enabled