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

We recommend using Azure Native.

Azure Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi

azure.storage.getContainers

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi

    Use this data source to access information about the existing Storage Containers within a Storage Account.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = azure.storage.getContainers({
        storageAccountId: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/sa1",
    });
    export const containerId = example.then(example => example.containers?.[0]?.resourceManagerId);
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.storage.get_containers(storage_account_id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/sa1")
    pulumi.export("containerId", example.containers[0].resource_manager_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/storage"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := storage.GetContainers(ctx, &storage.GetContainersArgs{
    			StorageAccountId: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/sa1",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("containerId", example.Containers[0].ResourceManagerId)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Azure.Storage.GetContainers.Invoke(new()
        {
            StorageAccountId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/sa1",
        });
    
        return new Dictionary<string, object?>
        {
            ["containerId"] = example.Apply(getContainersResult => getContainersResult.Containers[0]?.ResourceManagerId),
        };
    });
    
    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.storage.inputs.GetContainersArgs;
    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 example = StorageFunctions.getContainers(GetContainersArgs.builder()
                .storageAccountId("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/sa1")
                .build());
    
            ctx.export("containerId", example.applyValue(getContainersResult -> getContainersResult.containers()[0].resourceManagerId()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: azure:storage:getContainers
          Arguments:
            storageAccountId: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/sa1
    outputs:
      containerId: ${example.containers[0].resourceManagerId}
    

    Using getContainers

    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 getContainers(args: GetContainersArgs, opts?: InvokeOptions): Promise<GetContainersResult>
    function getContainersOutput(args: GetContainersOutputArgs, opts?: InvokeOptions): Output<GetContainersResult>
    def get_containers(name_prefix: Optional[str] = None,
                       storage_account_id: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> GetContainersResult
    def get_containers_output(name_prefix: Optional[pulumi.Input[str]] = None,
                       storage_account_id: Optional[pulumi.Input[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetContainersResult]
    func GetContainers(ctx *Context, args *GetContainersArgs, opts ...InvokeOption) (*GetContainersResult, error)
    func GetContainersOutput(ctx *Context, args *GetContainersOutputArgs, opts ...InvokeOption) GetContainersResultOutput

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

    public static class GetContainers 
    {
        public static Task<GetContainersResult> InvokeAsync(GetContainersArgs args, InvokeOptions? opts = null)
        public static Output<GetContainersResult> Invoke(GetContainersInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetContainersResult> getContainers(GetContainersArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: azure:storage/getContainers:getContainers
      arguments:
        # arguments dictionary

    The following arguments are supported:

    StorageAccountId string
    The ID of the Storage Account that the Storage Containers reside in.
    NamePrefix string
    A prefix match used for the Storage Container name field.
    StorageAccountId string
    The ID of the Storage Account that the Storage Containers reside in.
    NamePrefix string
    A prefix match used for the Storage Container name field.
    storageAccountId String
    The ID of the Storage Account that the Storage Containers reside in.
    namePrefix String
    A prefix match used for the Storage Container name field.
    storageAccountId string
    The ID of the Storage Account that the Storage Containers reside in.
    namePrefix string
    A prefix match used for the Storage Container name field.
    storage_account_id str
    The ID of the Storage Account that the Storage Containers reside in.
    name_prefix str
    A prefix match used for the Storage Container name field.
    storageAccountId String
    The ID of the Storage Account that the Storage Containers reside in.
    namePrefix String
    A prefix match used for the Storage Container name field.

    getContainers Result

    The following output properties are available:

    Containers List<GetContainersContainer>
    A containers block as defined below.
    Id string
    The provider-assigned unique ID for this managed resource.
    StorageAccountId string
    NamePrefix string
    Containers []GetContainersContainer
    A containers block as defined below.
    Id string
    The provider-assigned unique ID for this managed resource.
    StorageAccountId string
    NamePrefix string
    containers List<GetContainersContainer>
    A containers block as defined below.
    id String
    The provider-assigned unique ID for this managed resource.
    storageAccountId String
    namePrefix String
    containers GetContainersContainer[]
    A containers block as defined below.
    id string
    The provider-assigned unique ID for this managed resource.
    storageAccountId string
    namePrefix string
    containers Sequence[GetContainersContainer]
    A containers block as defined below.
    id str
    The provider-assigned unique ID for this managed resource.
    storage_account_id str
    name_prefix str
    containers List<Property Map>
    A containers block as defined below.
    id String
    The provider-assigned unique ID for this managed resource.
    storageAccountId String
    namePrefix String

    Supporting Types

    GetContainersContainer

    DataPlaneId string
    The data plane ID of the Storage Container.
    Name string
    The name of this Storage Container.
    ResourceManagerId string
    The resource manager ID of the Storage Container.
    DataPlaneId string
    The data plane ID of the Storage Container.
    Name string
    The name of this Storage Container.
    ResourceManagerId string
    The resource manager ID of the Storage Container.
    dataPlaneId String
    The data plane ID of the Storage Container.
    name String
    The name of this Storage Container.
    resourceManagerId String
    The resource manager ID of the Storage Container.
    dataPlaneId string
    The data plane ID of the Storage Container.
    name string
    The name of this Storage Container.
    resourceManagerId string
    The resource manager ID of the Storage Container.
    data_plane_id str
    The data plane ID of the Storage Container.
    name str
    The name of this Storage Container.
    resource_manager_id str
    The resource manager ID of the Storage Container.
    dataPlaneId String
    The data plane ID of the Storage Container.
    name String
    The name of this Storage Container.
    resourceManagerId String
    The resource manager ID of the Storage Container.

    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.

    Azure Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi