get Containers
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);
Content copied to clipboard
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)
Content copied to clipboard
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),
};
});
Content copied to clipboard
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
})
}
Content copied to clipboard
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()));
}
}
Content copied to clipboard
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}
Content copied to clipboard
Return
A collection of values returned by getContainers.
Parameters
argument
A collection of arguments for invoking getContainers.
suspend fun getContainers(namePrefix: String? = null, storageAccountId: String): GetContainersResult
Return
A collection of values returned by getContainers.
Parameters
name Prefix
A prefix match used for the Storage Container name
field.
storage Account Id
The ID of the Storage Account that the Storage Containers reside in.
See also
suspend fun getContainers(argument: suspend GetContainersPlainArgsBuilder.() -> Unit): GetContainersResult
Return
A collection of values returned by getContainers.
Parameters
argument
Builder for com.pulumi.azure.storage.kotlin.inputs.GetContainersPlainArgs.