Compartilhar via


Disks - Grant Access

Grants access to a disk.

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess?api-version=2024-03-02

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.

api-version
query True

string

Client Api Version.

Request Body

Name Required Type Description
access True

AccessLevel

durationInSeconds True

integer

Time duration in seconds until the SAS access expires.

fileFormat

FileFormat

Used to specify the file format when making request for SAS on a VHDX file format snapshot

getSecureVMGuestStateSAS

boolean

Set this flag to true to get additional SAS for VM guest state

Responses

Name Type Description
200 OK

AccessUri

OK

202 Accepted

Accepted

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Get a sas on a managed disk.
Get sas on managed disk and VM guest state

Get a sas on a managed disk.

Sample request

POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk/beginGetAccess?api-version=2024-03-02

{
  "access": "Read",
  "durationInSeconds": 300,
  "fileFormat": "VHD"
}

Sample response

{
  "accessSAS": "https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"
}
Location: https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/operations/{operationId}&monitor=true&api-version=2024-03-02

Get sas on managed disk and VM guest state

Sample request

POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk/beginGetAccess?api-version=2024-03-02

{
  "access": "Read",
  "durationInSeconds": 300,
  "getSecureVMGuestStateSAS": true
}

Sample response

{
  "accessSAS": "https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/abcd?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r",
  "securityDataAccessSAS": "https://md-gpvmcxzlzxgd.partition.blob.storage.azure.net/xx3cqcx53f0v/b9bf5824-6122-49e0-ba22-042f76ccd8a1_vmgs?sv=2014-02-14&sr=b&sk=key1&sig=XXX&st=2021-05-24T18:02:34Z&se=2021-05-24T18:19:14Z&sp=r"
}
Location: https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/operations/{operationId}&monitor=true&api-version=2024-03-02

Definitions

Name Description
AccessLevel
AccessUri

A disk access SAS uri.

FileFormat

Used to specify the file format when making request for SAS on a VHDX file format snapshot

GrantAccessData

Data used for requesting a SAS.

AccessLevel

Name Type Description
None

string

Read

string

Write

string

AccessUri

A disk access SAS uri.

Name Type Description
accessSAS

string

A SAS uri for accessing a disk.

securityDataAccessSAS

string

A SAS uri for accessing a VM guest state.

FileFormat

Used to specify the file format when making request for SAS on a VHDX file format snapshot

Name Type Description
VHD

string

A VHD file is a disk image file in the Virtual Hard Disk file format.

VHDX

string

A VHDX file is a disk image file in the Virtual Hard Disk v2 file format.

GrantAccessData

Data used for requesting a SAS.

Name Type Description
access

AccessLevel

durationInSeconds

integer

Time duration in seconds until the SAS access expires.

fileFormat

FileFormat

Used to specify the file format when making request for SAS on a VHDX file format snapshot

getSecureVMGuestStateSAS

boolean

Set this flag to true to get additional SAS for VM guest state