POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess?api-version=2021-12-01
URI Parameters
Name
In
Required
Type
Description
diskName
path
True
string
The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
resourceGroupName
path
True
string
The name of the resource group.
subscriptionId
path
True
string
Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk/beginGetAccess?api-version=2021-12-01
{
"access": "Read",
"durationInSeconds": 300
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.compute.models.AccessLevel;
import com.azure.resourcemanager.compute.models.GrantAccessData;
/** Samples for Disks GrantAccess. */
public final class Main {
/*
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-12-01/examples/BeginGetAccessManagedDisk.json
*/
/**
* Sample code: Get a sas on a managed disk.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getASasOnAManagedDisk(com.azure.resourcemanager.AzureResourceManager azure) {
azure
.virtualMachines()
.manager()
.serviceClient()
.getDisks()
.grantAccess(
"myResourceGroup",
"myDisk",
new GrantAccessData().withAccess(AccessLevel.READ).withDurationInSeconds(300),
Context.NONE);
}
}
POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk/beginGetAccess?api-version=2021-12-01
{
"access": "Read",
"durationInSeconds": 300,
"getSecureVMGuestStateSAS": true
}
import com.azure.core.util.Context;
import com.azure.resourcemanager.compute.models.AccessLevel;
import com.azure.resourcemanager.compute.models.GrantAccessData;
/** Samples for Disks GrantAccess. */
public final class Main {
/*
* x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/stable/2021-12-01/examples/BeginGetAccessManagedDiskWithVMGuestState.json
*/
/**
* Sample code: Get sas on managed disk and VM guest state.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getSasOnManagedDiskAndVMGuestState(com.azure.resourcemanager.AzureResourceManager azure) {
azure
.virtualMachines()
.manager()
.serviceClient()
.getDisks()
.grantAccess(
"myResourceGroup",
"myDisk",
new GrantAccessData()
.withAccess(AccessLevel.READ)
.withDurationInSeconds(300)
.withGetSecureVMGuestStateSas(true),
Context.NONE);
}
}