1. Packages
  2. Azure Classic
  3. API Docs
  4. compute
  5. getManagedDisk

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.compute.getManagedDisk

Explore with Pulumi AI

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

Use this data source to access information about an existing Managed Disk.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const existing = azure.compute.getManagedDisk({
    name: "example-datadisk",
    resourceGroupName: "example-resources",
});
export const id = existing.then(existing => existing.id);
Copy
import pulumi
import pulumi_azure as azure

existing = azure.compute.get_managed_disk(name="example-datadisk",
    resource_group_name="example-resources")
pulumi.export("id", existing.id)
Copy
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/compute"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		existing, err := compute.LookupManagedDisk(ctx, &compute.LookupManagedDiskArgs{
			Name:              "example-datadisk",
			ResourceGroupName: "example-resources",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("id", existing.Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var existing = Azure.Compute.GetManagedDisk.Invoke(new()
    {
        Name = "example-datadisk",
        ResourceGroupName = "example-resources",
    });

    return new Dictionary<string, object?>
    {
        ["id"] = existing.Apply(getManagedDiskResult => getManagedDiskResult.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.compute.ComputeFunctions;
import com.pulumi.azure.compute.inputs.GetManagedDiskArgs;
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 existing = ComputeFunctions.getManagedDisk(GetManagedDiskArgs.builder()
            .name("example-datadisk")
            .resourceGroupName("example-resources")
            .build());

        ctx.export("id", existing.applyValue(getManagedDiskResult -> getManagedDiskResult.id()));
    }
}
Copy
variables:
  existing:
    fn::invoke:
      function: azure:compute:getManagedDisk
      arguments:
        name: example-datadisk
        resourceGroupName: example-resources
outputs:
  id: ${existing.id}
Copy

Using getManagedDisk

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 getManagedDisk(args: GetManagedDiskArgs, opts?: InvokeOptions): Promise<GetManagedDiskResult>
function getManagedDiskOutput(args: GetManagedDiskOutputArgs, opts?: InvokeOptions): Output<GetManagedDiskResult>
Copy
def get_managed_disk(name: Optional[str] = None,
                     resource_group_name: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetManagedDiskResult
def get_managed_disk_output(name: Optional[pulumi.Input[str]] = None,
                     resource_group_name: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetManagedDiskResult]
Copy
func LookupManagedDisk(ctx *Context, args *LookupManagedDiskArgs, opts ...InvokeOption) (*LookupManagedDiskResult, error)
func LookupManagedDiskOutput(ctx *Context, args *LookupManagedDiskOutputArgs, opts ...InvokeOption) LookupManagedDiskResultOutput
Copy

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

public static class GetManagedDisk 
{
    public static Task<GetManagedDiskResult> InvokeAsync(GetManagedDiskArgs args, InvokeOptions? opts = null)
    public static Output<GetManagedDiskResult> Invoke(GetManagedDiskInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetManagedDiskResult> getManagedDisk(GetManagedDiskArgs args, InvokeOptions options)
public static Output<GetManagedDiskResult> getManagedDisk(GetManagedDiskArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azure:compute/getManagedDisk:getManagedDisk
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
Specifies the name of the Managed Disk.
ResourceGroupName This property is required. string
Specifies the name of the Resource Group where this Managed Disk exists.
Name This property is required. string
Specifies the name of the Managed Disk.
ResourceGroupName This property is required. string
Specifies the name of the Resource Group where this Managed Disk exists.
name This property is required. String
Specifies the name of the Managed Disk.
resourceGroupName This property is required. String
Specifies the name of the Resource Group where this Managed Disk exists.
name This property is required. string
Specifies the name of the Managed Disk.
resourceGroupName This property is required. string
Specifies the name of the Resource Group where this Managed Disk exists.
name This property is required. str
Specifies the name of the Managed Disk.
resource_group_name This property is required. str
Specifies the name of the Resource Group where this Managed Disk exists.
name This property is required. String
Specifies the name of the Managed Disk.
resourceGroupName This property is required. String
Specifies the name of the Resource Group where this Managed Disk exists.

getManagedDisk Result

The following output properties are available:

CreateOption string
DiskAccessId string
The ID of the disk access resource for using private endpoints on disks.
DiskEncryptionSetId string
The ID of the Disk Encryption Set used to encrypt this Managed Disk.
DiskIopsReadWrite int
The number of IOPS allowed for this disk, where one operation can transfer between 4k and 256k bytes.
DiskMbpsReadWrite int
The bandwidth allowed for this disk.
DiskSizeGb int
The size of the Managed Disk in gigabytes.
EncryptionSettings List<GetManagedDiskEncryptionSetting>
A encryption_settings block as defined below.
Id string
The provider-assigned unique ID for this managed resource.
ImageReferenceId string
The ID of the source image used for creating this Managed Disk.
Name string
NetworkAccessPolicy string
Policy for accessing the disk via network.
OsType string
The operating system used for this Managed Disk.
ResourceGroupName string
SourceResourceId string
The ID of an existing Managed Disk which this Disk was created from.
SourceUri string
The Source URI for this Managed Disk.
StorageAccountId string
The ID of the Storage Account where the source_uri is located.
StorageAccountType string
The storage account type for the Managed Disk.
Tags Dictionary<string, string>
A mapping of tags assigned to the resource.
Zones List<string>
A list of Availability Zones where the Managed Disk exists.
CreateOption string
DiskAccessId string
The ID of the disk access resource for using private endpoints on disks.
DiskEncryptionSetId string
The ID of the Disk Encryption Set used to encrypt this Managed Disk.
DiskIopsReadWrite int
The number of IOPS allowed for this disk, where one operation can transfer between 4k and 256k bytes.
DiskMbpsReadWrite int
The bandwidth allowed for this disk.
DiskSizeGb int
The size of the Managed Disk in gigabytes.
EncryptionSettings []GetManagedDiskEncryptionSetting
A encryption_settings block as defined below.
Id string
The provider-assigned unique ID for this managed resource.
ImageReferenceId string
The ID of the source image used for creating this Managed Disk.
Name string
NetworkAccessPolicy string
Policy for accessing the disk via network.
OsType string
The operating system used for this Managed Disk.
ResourceGroupName string
SourceResourceId string
The ID of an existing Managed Disk which this Disk was created from.
SourceUri string
The Source URI for this Managed Disk.
StorageAccountId string
The ID of the Storage Account where the source_uri is located.
StorageAccountType string
The storage account type for the Managed Disk.
Tags map[string]string
A mapping of tags assigned to the resource.
Zones []string
A list of Availability Zones where the Managed Disk exists.
createOption String
diskAccessId String
The ID of the disk access resource for using private endpoints on disks.
diskEncryptionSetId String
The ID of the Disk Encryption Set used to encrypt this Managed Disk.
diskIopsReadWrite Integer
The number of IOPS allowed for this disk, where one operation can transfer between 4k and 256k bytes.
diskMbpsReadWrite Integer
The bandwidth allowed for this disk.
diskSizeGb Integer
The size of the Managed Disk in gigabytes.
encryptionSettings List<GetManagedDiskEncryptionSetting>
A encryption_settings block as defined below.
id String
The provider-assigned unique ID for this managed resource.
imageReferenceId String
The ID of the source image used for creating this Managed Disk.
name String
networkAccessPolicy String
Policy for accessing the disk via network.
osType String
The operating system used for this Managed Disk.
resourceGroupName String
sourceResourceId String
The ID of an existing Managed Disk which this Disk was created from.
sourceUri String
The Source URI for this Managed Disk.
storageAccountId String
The ID of the Storage Account where the source_uri is located.
storageAccountType String
The storage account type for the Managed Disk.
tags Map<String,String>
A mapping of tags assigned to the resource.
zones List<String>
A list of Availability Zones where the Managed Disk exists.
createOption string
diskAccessId string
The ID of the disk access resource for using private endpoints on disks.
diskEncryptionSetId string
The ID of the Disk Encryption Set used to encrypt this Managed Disk.
diskIopsReadWrite number
The number of IOPS allowed for this disk, where one operation can transfer between 4k and 256k bytes.
diskMbpsReadWrite number
The bandwidth allowed for this disk.
diskSizeGb number
The size of the Managed Disk in gigabytes.
encryptionSettings GetManagedDiskEncryptionSetting[]
A encryption_settings block as defined below.
id string
The provider-assigned unique ID for this managed resource.
imageReferenceId string
The ID of the source image used for creating this Managed Disk.
name string
networkAccessPolicy string
Policy for accessing the disk via network.
osType string
The operating system used for this Managed Disk.
resourceGroupName string
sourceResourceId string
The ID of an existing Managed Disk which this Disk was created from.
sourceUri string
The Source URI for this Managed Disk.
storageAccountId string
The ID of the Storage Account where the source_uri is located.
storageAccountType string
The storage account type for the Managed Disk.
tags {[key: string]: string}
A mapping of tags assigned to the resource.
zones string[]
A list of Availability Zones where the Managed Disk exists.
create_option str
disk_access_id str
The ID of the disk access resource for using private endpoints on disks.
disk_encryption_set_id str
The ID of the Disk Encryption Set used to encrypt this Managed Disk.
disk_iops_read_write int
The number of IOPS allowed for this disk, where one operation can transfer between 4k and 256k bytes.
disk_mbps_read_write int
The bandwidth allowed for this disk.
disk_size_gb int
The size of the Managed Disk in gigabytes.
encryption_settings Sequence[GetManagedDiskEncryptionSetting]
A encryption_settings block as defined below.
id str
The provider-assigned unique ID for this managed resource.
image_reference_id str
The ID of the source image used for creating this Managed Disk.
name str
network_access_policy str
Policy for accessing the disk via network.
os_type str
The operating system used for this Managed Disk.
resource_group_name str
source_resource_id str
The ID of an existing Managed Disk which this Disk was created from.
source_uri str
The Source URI for this Managed Disk.
storage_account_id str
The ID of the Storage Account where the source_uri is located.
storage_account_type str
The storage account type for the Managed Disk.
tags Mapping[str, str]
A mapping of tags assigned to the resource.
zones Sequence[str]
A list of Availability Zones where the Managed Disk exists.
createOption String
diskAccessId String
The ID of the disk access resource for using private endpoints on disks.
diskEncryptionSetId String
The ID of the Disk Encryption Set used to encrypt this Managed Disk.
diskIopsReadWrite Number
The number of IOPS allowed for this disk, where one operation can transfer between 4k and 256k bytes.
diskMbpsReadWrite Number
The bandwidth allowed for this disk.
diskSizeGb Number
The size of the Managed Disk in gigabytes.
encryptionSettings List<Property Map>
A encryption_settings block as defined below.
id String
The provider-assigned unique ID for this managed resource.
imageReferenceId String
The ID of the source image used for creating this Managed Disk.
name String
networkAccessPolicy String
Policy for accessing the disk via network.
osType String
The operating system used for this Managed Disk.
resourceGroupName String
sourceResourceId String
The ID of an existing Managed Disk which this Disk was created from.
sourceUri String
The Source URI for this Managed Disk.
storageAccountId String
The ID of the Storage Account where the source_uri is located.
storageAccountType String
The storage account type for the Managed Disk.
tags Map<String>
A mapping of tags assigned to the resource.
zones List<String>
A list of Availability Zones where the Managed Disk exists.

Supporting Types

GetManagedDiskEncryptionSetting

DiskEncryptionKeys This property is required. List<GetManagedDiskEncryptionSettingDiskEncryptionKey>
A disk_encryption_key block as defined above.
Enabled This property is required. bool
KeyEncryptionKeys This property is required. List<GetManagedDiskEncryptionSettingKeyEncryptionKey>
A key_encryption_key block as defined below.
DiskEncryptionKeys This property is required. []GetManagedDiskEncryptionSettingDiskEncryptionKey
A disk_encryption_key block as defined above.
Enabled This property is required. bool
KeyEncryptionKeys This property is required. []GetManagedDiskEncryptionSettingKeyEncryptionKey
A key_encryption_key block as defined below.
diskEncryptionKeys This property is required. List<GetManagedDiskEncryptionSettingDiskEncryptionKey>
A disk_encryption_key block as defined above.
enabled This property is required. Boolean
keyEncryptionKeys This property is required. List<GetManagedDiskEncryptionSettingKeyEncryptionKey>
A key_encryption_key block as defined below.
diskEncryptionKeys This property is required. GetManagedDiskEncryptionSettingDiskEncryptionKey[]
A disk_encryption_key block as defined above.
enabled This property is required. boolean
keyEncryptionKeys This property is required. GetManagedDiskEncryptionSettingKeyEncryptionKey[]
A key_encryption_key block as defined below.
disk_encryption_keys This property is required. Sequence[GetManagedDiskEncryptionSettingDiskEncryptionKey]
A disk_encryption_key block as defined above.
enabled This property is required. bool
key_encryption_keys This property is required. Sequence[GetManagedDiskEncryptionSettingKeyEncryptionKey]
A key_encryption_key block as defined below.
diskEncryptionKeys This property is required. List<Property Map>
A disk_encryption_key block as defined above.
enabled This property is required. Boolean
keyEncryptionKeys This property is required. List<Property Map>
A key_encryption_key block as defined below.

GetManagedDiskEncryptionSettingDiskEncryptionKey

SecretUrl This property is required. string
The URL to the Key Vault Secret used as the Disk Encryption Key.
SourceVaultId This property is required. string
The ID of the source Key Vault.
SecretUrl This property is required. string
The URL to the Key Vault Secret used as the Disk Encryption Key.
SourceVaultId This property is required. string
The ID of the source Key Vault.
secretUrl This property is required. String
The URL to the Key Vault Secret used as the Disk Encryption Key.
sourceVaultId This property is required. String
The ID of the source Key Vault.
secretUrl This property is required. string
The URL to the Key Vault Secret used as the Disk Encryption Key.
sourceVaultId This property is required. string
The ID of the source Key Vault.
secret_url This property is required. str
The URL to the Key Vault Secret used as the Disk Encryption Key.
source_vault_id This property is required. str
The ID of the source Key Vault.
secretUrl This property is required. String
The URL to the Key Vault Secret used as the Disk Encryption Key.
sourceVaultId This property is required. String
The ID of the source Key Vault.

GetManagedDiskEncryptionSettingKeyEncryptionKey

KeyUrl This property is required. string
The URL to the Key Vault Key used as the Key Encryption Key.
SourceVaultId This property is required. string
The ID of the source Key Vault.
KeyUrl This property is required. string
The URL to the Key Vault Key used as the Key Encryption Key.
SourceVaultId This property is required. string
The ID of the source Key Vault.
keyUrl This property is required. String
The URL to the Key Vault Key used as the Key Encryption Key.
sourceVaultId This property is required. String
The ID of the source Key Vault.
keyUrl This property is required. string
The URL to the Key Vault Key used as the Key Encryption Key.
sourceVaultId This property is required. string
The ID of the source Key Vault.
key_url This property is required. str
The URL to the Key Vault Key used as the Key Encryption Key.
source_vault_id This property is required. str
The ID of the source Key Vault.
keyUrl This property is required. String
The URL to the Key Vault Key used as the Key Encryption Key.
sourceVaultId This property is required. String
The ID of the source Key Vault.

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi