We recommend using Azure Native.
Azure v6.28.0 published on Friday, Oct 3, 2025 by Pulumi
azure.storage.getContainers
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.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)
public static Output<GetContainersResult> getContainers(GetContainersArgs args, InvokeOptions options)
fn::invoke:
function: azure:storage/getContainers:getContainers
arguments:
# arguments dictionary
The following arguments are supported:
- Storage
Account stringId - The ID of the Storage Account that the Storage Containers reside in.
- Name
Prefix string - A prefix match used for the Storage Container
name
field.
- Storage
Account stringId - The ID of the Storage Account that the Storage Containers reside in.
- Name
Prefix string - A prefix match used for the Storage Container
name
field.
- storage
Account StringId - The ID of the Storage Account that the Storage Containers reside in.
- name
Prefix String - A prefix match used for the Storage Container
name
field.
- storage
Account stringId - The ID of the Storage Account that the Storage Containers reside in.
- name
Prefix string - A prefix match used for the Storage Container
name
field.
- storage_
account_ strid - 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.
- storage
Account StringId - The ID of the Storage Account that the Storage Containers reside in.
- name
Prefix String - A prefix match used for the Storage Container
name
field.
getContainers Result
The following output properties are available:
- Containers
List<Get
Containers Container> - A
containers
block as defined below. - Id string
- The provider-assigned unique ID for this managed resource.
- Storage
Account stringId - Name
Prefix string
- Containers
[]Get
Containers Container - A
containers
block as defined below. - Id string
- The provider-assigned unique ID for this managed resource.
- Storage
Account stringId - Name
Prefix string
- containers
List<Get
Containers Container> - A
containers
block as defined below. - id String
- The provider-assigned unique ID for this managed resource.
- storage
Account StringId - name
Prefix String
- containers
Get
Containers Container[] - A
containers
block as defined below. - id string
- The provider-assigned unique ID for this managed resource.
- storage
Account stringId - name
Prefix string
- containers
Sequence[Get
Containers Container] - A
containers
block as defined below. - id str
- The provider-assigned unique ID for this managed resource.
- storage_
account_ strid - name_
prefix str
- containers List<Property Map>
- A
containers
block as defined below. - id String
- The provider-assigned unique ID for this managed resource.
- storage
Account StringId - name
Prefix String
Supporting Types
GetContainersContainer
- Data
Plane stringId - The data plane ID of the Storage Container.
- Name string
- The name of this Storage Container.
- Resource
Manager stringId - The resource manager ID of the Storage Container.
- Data
Plane stringId - The data plane ID of the Storage Container.
- Name string
- The name of this Storage Container.
- Resource
Manager stringId - The resource manager ID of the Storage Container.
- data
Plane StringId - The data plane ID of the Storage Container.
- name String
- The name of this Storage Container.
- resource
Manager StringId - The resource manager ID of the Storage Container.
- data
Plane stringId - The data plane ID of the Storage Container.
- name string
- The name of this Storage Container.
- resource
Manager stringId - The resource manager ID of the Storage Container.
- data_
plane_ strid - The data plane ID of the Storage Container.
- name str
- The name of this Storage Container.
- resource_
manager_ strid - The resource manager ID of the Storage Container.
- data
Plane StringId - The data plane ID of the Storage Container.
- name String
- The name of this Storage Container.
- resource
Manager StringId - 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.