Azure Classic

Pulumi Official
Package maintained by Pulumi
v5.14.0 published on Thursday, Jul 28, 2022 by Pulumi

getPolicy

Use this data source to access information about an existing Storage Management Policy.

Example Usage

using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleAccount = Output.Create(Azure.Storage.GetAccount.InvokeAsync(new Azure.Storage.GetAccountArgs
        {
            Name = "storageaccountname",
            ResourceGroupName = "resourcegroupname",
        }));
        var examplePolicy = exampleAccount.Apply(exampleAccount => Output.Create(Azure.Storage.GetPolicy.InvokeAsync(new Azure.Storage.GetPolicyArgs
        {
            StorageAccountId = exampleAccount.Id,
        })));
    }

}
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleAccount, err := storage.LookupAccount(ctx, &storage.LookupAccountArgs{
			Name:              "storageaccountname",
			ResourceGroupName: pulumi.StringRef("resourcegroupname"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = storage.GetPolicy(ctx, &storage.GetPolicyArgs{
			StorageAccountId: exampleAccount.Id,
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.storage.StorageFunctions;
import com.pulumi.azure.automation.inputs.GetAccountArgs;
import com.pulumi.azure.storage.inputs.GetPolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var exampleAccount = StorageFunctions.getAccount(GetAccountArgs.builder()
            .name("storageaccountname")
            .resourceGroupName("resourcegroupname")
            .build());

        final var examplePolicy = StorageFunctions.getPolicy(GetPolicyArgs.builder()
            .storageAccountId(exampleAccount.applyValue(getAccountResult -> getAccountResult.id()))
            .build());

    }
}
import pulumi
import pulumi_azure as azure

example_account = azure.storage.get_account(name="storageaccountname",
    resource_group_name="resourcegroupname")
example_policy = azure.storage.get_policy(storage_account_id=example_account.id)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const exampleAccount = azure.storage.getAccount({
    name: "storageaccountname",
    resourceGroupName: "resourcegroupname",
});
const examplePolicy = exampleAccount.then(exampleAccount => azure.storage.getPolicy({
    storageAccountId: exampleAccount.id,
}));
variables:
  exampleAccount:
    Fn::Invoke:
      Function: azure:storage:getAccount
      Arguments:
        name: storageaccountname
        resourceGroupName: resourcegroupname
  examplePolicy:
    Fn::Invoke:
      Function: azure:storage:getPolicy
      Arguments:
        storageAccountId: ${exampleAccount.id}

Using getPolicy

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getPolicy(args: GetPolicyArgs, opts?: InvokeOptions): Promise<GetPolicyResult>
function getPolicyOutput(args: GetPolicyOutputArgs, opts?: InvokeOptions): Output<GetPolicyResult>
def get_policy(storage_account_id: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetPolicyResult
def get_policy_output(storage_account_id: Optional[pulumi.Input[str]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetPolicyResult]
func GetPolicy(ctx *Context, args *GetPolicyArgs, opts ...InvokeOption) (*GetPolicyResult, error)
func GetPolicyOutput(ctx *Context, args *GetPolicyOutputArgs, opts ...InvokeOption) GetPolicyResultOutput

> Note: This function is named GetPolicy in the Go SDK.

public static class GetPolicy 
{
    public static Task<GetPolicyResult> InvokeAsync(GetPolicyArgs args, InvokeOptions? opts = null)
    public static Output<GetPolicyResult> Invoke(GetPolicyInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetPolicyResult> getPolicy(GetPolicyArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: azure:storage/getPolicy:getPolicy
  Arguments:
    # Arguments dictionary

The following arguments are supported:

StorageAccountId string

Specifies the id of the storage account to retrieve the management policy for.

StorageAccountId string

Specifies the id of the storage account to retrieve the management policy for.

storageAccountId String

Specifies the id of the storage account to retrieve the management policy for.

storageAccountId string

Specifies the id of the storage account to retrieve the management policy for.

storage_account_id str

Specifies the id of the storage account to retrieve the management policy for.

storageAccountId String

Specifies the id of the storage account to retrieve the management policy for.

getPolicy Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Rules List<GetPolicyRule>

A rule block as documented below.

StorageAccountId string
Id string

The provider-assigned unique ID for this managed resource.

Rules []GetPolicyRule

A rule block as documented below.

StorageAccountId string
id String

The provider-assigned unique ID for this managed resource.

rules List<GetPolicyRule>

A rule block as documented below.

storageAccountId String
id string

The provider-assigned unique ID for this managed resource.

rules GetPolicyRule[]

A rule block as documented below.

storageAccountId string
id str

The provider-assigned unique ID for this managed resource.

rules Sequence[GetPolicyRule]

A rule block as documented below.

storage_account_id str
id String

The provider-assigned unique ID for this managed resource.

rules List<Property Map>

A rule block as documented below.

storageAccountId String

Supporting Types

GetPolicyRule

Actions List<GetPolicyRuleAction>

An actions block as documented below.

Enabled bool

Boolean to specify whether the rule is enabled.

Filters List<GetPolicyRuleFilter>

A filter block as documented below.

Name string

The filter tag name used for tag based filtering for blob objects.

Actions []GetPolicyRuleAction

An actions block as documented below.

Enabled bool

Boolean to specify whether the rule is enabled.

Filters []GetPolicyRuleFilter

A filter block as documented below.

Name string

The filter tag name used for tag based filtering for blob objects.

actions List<GetPolicyRuleAction>

An actions block as documented below.

enabled Boolean

Boolean to specify whether the rule is enabled.

filters List<GetPolicyRuleFilter>

A filter block as documented below.

name String

The filter tag name used for tag based filtering for blob objects.

actions GetPolicyRuleAction[]

An actions block as documented below.

enabled boolean

Boolean to specify whether the rule is enabled.

filters GetPolicyRuleFilter[]

A filter block as documented below.

name string

The filter tag name used for tag based filtering for blob objects.

actions Sequence[GetPolicyRuleAction]

An actions block as documented below.

enabled bool

Boolean to specify whether the rule is enabled.

filters Sequence[GetPolicyRuleFilter]

A filter block as documented below.

name str

The filter tag name used for tag based filtering for blob objects.

actions List<Property Map>

An actions block as documented below.

enabled Boolean

Boolean to specify whether the rule is enabled.

filters List<Property Map>

A filter block as documented below.

name String

The filter tag name used for tag based filtering for blob objects.

GetPolicyRuleAction

BaseBlobs List<GetPolicyRuleActionBaseBlob>

A base_blob block as documented below.

Snapshots List<GetPolicyRuleActionSnapshot>

A snapshot block as documented below.

Versions List<GetPolicyRuleActionVersion>

A version block as documented below.

BaseBlobs []GetPolicyRuleActionBaseBlob

A base_blob block as documented below.

Snapshots []GetPolicyRuleActionSnapshot

A snapshot block as documented below.

Versions []GetPolicyRuleActionVersion

A version block as documented below.

baseBlobs List<GetPolicyRuleActionBaseBlob>

A base_blob block as documented below.

snapshots List<GetPolicyRuleActionSnapshot>

A snapshot block as documented below.

versions List<GetPolicyRuleActionVersion>

A version block as documented below.

baseBlobs GetPolicyRuleActionBaseBlob[]

A base_blob block as documented below.

snapshots GetPolicyRuleActionSnapshot[]

A snapshot block as documented below.

versions GetPolicyRuleActionVersion[]

A version block as documented below.

base_blobs Sequence[GetPolicyRuleActionBaseBlob]

A base_blob block as documented below.

snapshots Sequence[GetPolicyRuleActionSnapshot]

A snapshot block as documented below.

versions Sequence[GetPolicyRuleActionVersion]

A version block as documented below.

baseBlobs List<Property Map>

A base_blob block as documented below.

snapshots List<Property Map>

A snapshot block as documented below.

versions List<Property Map>

A version block as documented below.

GetPolicyRuleActionBaseBlob

DeleteAfterDaysSinceLastAccessTimeGreaterThan int

The age in days after last access time to delete the blob.

DeleteAfterDaysSinceModificationGreaterThan int

The age in days after last modification to delete the blob.

TierToArchiveAfterDaysSinceLastAccessTimeGreaterThan int

The age in days after last access time to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.

TierToArchiveAfterDaysSinceModificationGreaterThan int

The age in days after last modification to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.

TierToCoolAfterDaysSinceLastAccessTimeGreaterThan int

The age in days after last access time to tier blobs to cool storage. Supports blob currently at Hot tier.

TierToCoolAfterDaysSinceModificationGreaterThan int

The age in days after last modification to tier blobs to cool storage. Supports blob currently at Hot tier.

DeleteAfterDaysSinceLastAccessTimeGreaterThan int

The age in days after last access time to delete the blob.

DeleteAfterDaysSinceModificationGreaterThan int

The age in days after last modification to delete the blob.

TierToArchiveAfterDaysSinceLastAccessTimeGreaterThan int

The age in days after last access time to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.

TierToArchiveAfterDaysSinceModificationGreaterThan int

The age in days after last modification to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.

TierToCoolAfterDaysSinceLastAccessTimeGreaterThan int

The age in days after last access time to tier blobs to cool storage. Supports blob currently at Hot tier.

TierToCoolAfterDaysSinceModificationGreaterThan int

The age in days after last modification to tier blobs to cool storage. Supports blob currently at Hot tier.

deleteAfterDaysSinceLastAccessTimeGreaterThan Integer

The age in days after last access time to delete the blob.

deleteAfterDaysSinceModificationGreaterThan Integer

The age in days after last modification to delete the blob.

tierToArchiveAfterDaysSinceLastAccessTimeGreaterThan Integer

The age in days after last access time to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.

tierToArchiveAfterDaysSinceModificationGreaterThan Integer

The age in days after last modification to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.

tierToCoolAfterDaysSinceLastAccessTimeGreaterThan Integer

The age in days after last access time to tier blobs to cool storage. Supports blob currently at Hot tier.

tierToCoolAfterDaysSinceModificationGreaterThan Integer

The age in days after last modification to tier blobs to cool storage. Supports blob currently at Hot tier.

deleteAfterDaysSinceLastAccessTimeGreaterThan number

The age in days after last access time to delete the blob.

deleteAfterDaysSinceModificationGreaterThan number

The age in days after last modification to delete the blob.

tierToArchiveAfterDaysSinceLastAccessTimeGreaterThan number

The age in days after last access time to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.

tierToArchiveAfterDaysSinceModificationGreaterThan number

The age in days after last modification to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.

tierToCoolAfterDaysSinceLastAccessTimeGreaterThan number

The age in days after last access time to tier blobs to cool storage. Supports blob currently at Hot tier.

tierToCoolAfterDaysSinceModificationGreaterThan number

The age in days after last modification to tier blobs to cool storage. Supports blob currently at Hot tier.

delete_after_days_since_last_access_time_greater_than int

The age in days after last access time to delete the blob.

delete_after_days_since_modification_greater_than int

The age in days after last modification to delete the blob.

tier_to_archive_after_days_since_last_access_time_greater_than int

The age in days after last access time to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.

tier_to_archive_after_days_since_modification_greater_than int

The age in days after last modification to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.

tier_to_cool_after_days_since_last_access_time_greater_than int

The age in days after last access time to tier blobs to cool storage. Supports blob currently at Hot tier.

tier_to_cool_after_days_since_modification_greater_than int

The age in days after last modification to tier blobs to cool storage. Supports blob currently at Hot tier.

deleteAfterDaysSinceLastAccessTimeGreaterThan Number

The age in days after last access time to delete the blob.

deleteAfterDaysSinceModificationGreaterThan Number

The age in days after last modification to delete the blob.

tierToArchiveAfterDaysSinceLastAccessTimeGreaterThan Number

The age in days after last access time to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.

tierToArchiveAfterDaysSinceModificationGreaterThan Number

The age in days after last modification to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.

tierToCoolAfterDaysSinceLastAccessTimeGreaterThan Number

The age in days after last access time to tier blobs to cool storage. Supports blob currently at Hot tier.

tierToCoolAfterDaysSinceModificationGreaterThan Number

The age in days after last modification to tier blobs to cool storage. Supports blob currently at Hot tier.

GetPolicyRuleActionSnapshot

ChangeTierToArchiveAfterDaysSinceCreation int

The age in days after creation to tier blob version to archive storage.

ChangeTierToCoolAfterDaysSinceCreation int

The age in days after creation to tier blob version to cool storage.

DeleteAfterDaysSinceCreationGreaterThan int

The age in days after creation to delete the blob snapshot.

ChangeTierToArchiveAfterDaysSinceCreation int

The age in days after creation to tier blob version to archive storage.

ChangeTierToCoolAfterDaysSinceCreation int

The age in days after creation to tier blob version to cool storage.

DeleteAfterDaysSinceCreationGreaterThan int

The age in days after creation to delete the blob snapshot.

changeTierToArchiveAfterDaysSinceCreation Integer

The age in days after creation to tier blob version to archive storage.

changeTierToCoolAfterDaysSinceCreation Integer

The age in days after creation to tier blob version to cool storage.

deleteAfterDaysSinceCreationGreaterThan Integer

The age in days after creation to delete the blob snapshot.

changeTierToArchiveAfterDaysSinceCreation number

The age in days after creation to tier blob version to archive storage.

changeTierToCoolAfterDaysSinceCreation number

The age in days after creation to tier blob version to cool storage.

deleteAfterDaysSinceCreationGreaterThan number

The age in days after creation to delete the blob snapshot.

change_tier_to_archive_after_days_since_creation int

The age in days after creation to tier blob version to archive storage.

change_tier_to_cool_after_days_since_creation int

The age in days after creation to tier blob version to cool storage.

delete_after_days_since_creation_greater_than int

The age in days after creation to delete the blob snapshot.

changeTierToArchiveAfterDaysSinceCreation Number

The age in days after creation to tier blob version to archive storage.

changeTierToCoolAfterDaysSinceCreation Number

The age in days after creation to tier blob version to cool storage.

deleteAfterDaysSinceCreationGreaterThan Number

The age in days after creation to delete the blob snapshot.

GetPolicyRuleActionVersion

ChangeTierToArchiveAfterDaysSinceCreation int

The age in days after creation to tier blob version to archive storage.

ChangeTierToCoolAfterDaysSinceCreation int

The age in days after creation to tier blob version to cool storage.

DeleteAfterDaysSinceCreation int

The age in days after creation to delete the blob version.

ChangeTierToArchiveAfterDaysSinceCreation int

The age in days after creation to tier blob version to archive storage.

ChangeTierToCoolAfterDaysSinceCreation int

The age in days after creation to tier blob version to cool storage.

DeleteAfterDaysSinceCreation int

The age in days after creation to delete the blob version.

changeTierToArchiveAfterDaysSinceCreation Integer

The age in days after creation to tier blob version to archive storage.

changeTierToCoolAfterDaysSinceCreation Integer

The age in days after creation to tier blob version to cool storage.

deleteAfterDaysSinceCreation Integer

The age in days after creation to delete the blob version.

changeTierToArchiveAfterDaysSinceCreation number

The age in days after creation to tier blob version to archive storage.

changeTierToCoolAfterDaysSinceCreation number

The age in days after creation to tier blob version to cool storage.

deleteAfterDaysSinceCreation number

The age in days after creation to delete the blob version.

change_tier_to_archive_after_days_since_creation int

The age in days after creation to tier blob version to archive storage.

change_tier_to_cool_after_days_since_creation int

The age in days after creation to tier blob version to cool storage.

delete_after_days_since_creation int

The age in days after creation to delete the blob version.

changeTierToArchiveAfterDaysSinceCreation Number

The age in days after creation to tier blob version to archive storage.

changeTierToCoolAfterDaysSinceCreation Number

The age in days after creation to tier blob version to cool storage.

deleteAfterDaysSinceCreation Number

The age in days after creation to delete the blob version.

GetPolicyRuleFilter

BlobTypes List<string>

An array of predefined values. Valid options are blockBlob and appendBlob.

MatchBlobIndexTags List<GetPolicyRuleFilterMatchBlobIndexTag>

A match_blob_index_tag block as defined below. The block defines the blob index tag based filtering for blob objects.

PrefixMatches List<string>

An array of strings for prefixes to be matched.

BlobTypes []string

An array of predefined values. Valid options are blockBlob and appendBlob.

MatchBlobIndexTags []GetPolicyRuleFilterMatchBlobIndexTag

A match_blob_index_tag block as defined below. The block defines the blob index tag based filtering for blob objects.

PrefixMatches []string

An array of strings for prefixes to be matched.

blobTypes List<String>

An array of predefined values. Valid options are blockBlob and appendBlob.

matchBlobIndexTags List<GetPolicyRuleFilterMatchBlobIndexTag>

A match_blob_index_tag block as defined below. The block defines the blob index tag based filtering for blob objects.

prefixMatches List<String>

An array of strings for prefixes to be matched.

blobTypes string[]

An array of predefined values. Valid options are blockBlob and appendBlob.

matchBlobIndexTags GetPolicyRuleFilterMatchBlobIndexTag[]

A match_blob_index_tag block as defined below. The block defines the blob index tag based filtering for blob objects.

prefixMatches string[]

An array of strings for prefixes to be matched.

blob_types Sequence[str]

An array of predefined values. Valid options are blockBlob and appendBlob.

match_blob_index_tags Sequence[GetPolicyRuleFilterMatchBlobIndexTag]

A match_blob_index_tag block as defined below. The block defines the blob index tag based filtering for blob objects.

prefix_matches Sequence[str]

An array of strings for prefixes to be matched.

blobTypes List<String>

An array of predefined values. Valid options are blockBlob and appendBlob.

matchBlobIndexTags List<Property Map>

A match_blob_index_tag block as defined below. The block defines the blob index tag based filtering for blob objects.

prefixMatches List<String>

An array of strings for prefixes to be matched.

GetPolicyRuleFilterMatchBlobIndexTag

Name string

The filter tag name used for tag based filtering for blob objects.

Operation string

The comparison operator which is used for object comparison and filtering. Possible value is ==. Defaults to ==.

Value string

The filter tag value used for tag based filtering for blob objects.

Name string

The filter tag name used for tag based filtering for blob objects.

Operation string

The comparison operator which is used for object comparison and filtering. Possible value is ==. Defaults to ==.

Value string

The filter tag value used for tag based filtering for blob objects.

name String

The filter tag name used for tag based filtering for blob objects.

operation String

The comparison operator which is used for object comparison and filtering. Possible value is ==. Defaults to ==.

value String

The filter tag value used for tag based filtering for blob objects.

name string

The filter tag name used for tag based filtering for blob objects.

operation string

The comparison operator which is used for object comparison and filtering. Possible value is ==. Defaults to ==.

value string

The filter tag value used for tag based filtering for blob objects.

name str

The filter tag name used for tag based filtering for blob objects.

operation str

The comparison operator which is used for object comparison and filtering. Possible value is ==. Defaults to ==.

value str

The filter tag value used for tag based filtering for blob objects.

name String

The filter tag name used for tag based filtering for blob objects.

operation String

The comparison operator which is used for object comparison and filtering. Possible value is ==. Defaults to ==.

value String

The filter tag value used for tag based filtering for blob objects.

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.