1. Packages
  2. Azure Classic
  3. API Docs
  4. storage
  5. getPolicy

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
azure logo

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    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 = Output.Create(Azure.Storage.GetPolicy.InvokeAsync(new Azure.Storage.GetPolicyArgs
            {
                StorageAccountId = azurerm_storage_account.Example.Id,
            }));
        }
    
    }
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/storage"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, 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: azurerm_storage_account.Example.Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    

    Example coming soon!

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const exampleAccount = azure.storage.getAccount({
        name: "storageaccountname",
        resourceGroupName: "resourcegroupname",
    });
    const examplePolicy = azure.storage.getPolicy({
        storageAccountId: azurerm_storage_account.example.id,
    });
    
    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=azurerm_storage_account["example"]["id"])
    

    Example coming soon!

    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)
    public static Output<GetPolicyResult> getPolicy(GetPolicyArgs args, InvokeOptions options)
    
    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

    DeleteAfterDaysSinceModificationGreaterThan int
    The age in days after last modification to delete the blob.
    TierToArchiveAfterDaysSinceModificationGreaterThan int
    The age in days after last modification to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.
    TierToCoolAfterDaysSinceModificationGreaterThan int
    The age in days after last modification to tier blobs to cool storage. Supports blob currently at Hot tier.
    DeleteAfterDaysSinceModificationGreaterThan int
    The age in days after last modification to delete the blob.
    TierToArchiveAfterDaysSinceModificationGreaterThan int
    The age in days after last modification to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.
    TierToCoolAfterDaysSinceModificationGreaterThan int
    The age in days after last modification to tier blobs to cool storage. Supports blob currently at Hot tier.
    deleteAfterDaysSinceModificationGreaterThan Integer
    The age in days after last modification to delete the blob.
    tierToArchiveAfterDaysSinceModificationGreaterThan Integer
    The age in days after last modification to tier blobs to archive storage. Supports blob currently at Hot or Cool tier.
    tierToCoolAfterDaysSinceModificationGreaterThan Integer
    The age in days after last modification to tier blobs to cool storage. Supports blob currently at Hot tier.
    deleteAfterDaysSinceModificationGreaterThan number
    The age in days after last modification to delete the blob.
    tierToArchiveAfterDaysSinceModificationGreaterThan number
    The age in days after last modification to tier blobs to archive storage. Supports blob currently at Hot or Cool 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_modification_greater_than int
    The age in days after last modification to delete the blob.
    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_modification_greater_than int
    The age in days after last modification to tier blobs to cool storage. Supports blob currently at Hot tier.
    deleteAfterDaysSinceModificationGreaterThan Number
    The age in days after last modification to delete the blob.
    tierToArchiveAfterDaysSinceModificationGreaterThan Number
    The age in days after last modification to tier blobs to archive storage. Supports blob currently at Hot or Cool 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
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Viewing docs for Azure v4.42.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.