你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
File Shares - Lease
The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/lease?api-version=2023-05-01
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
account
|
path | True |
string |
The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. Regex pattern: |
resource
|
path | True |
string |
The name of the resource group within the user's subscription. The name is case insensitive. Regex pattern: |
share
|
path | True |
string |
The name of the file share within the specified storage account. File share names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. |
subscription
|
path | True |
string |
The ID of the target subscription. |
api-version
|
query | True |
string |
The API version to use for this operation. |
Request Header
Name | Required | Type | Description |
---|---|---|---|
x-ms-snapshot |
string |
Optional. Specify the snapshot time to lease a snapshot. |
Request Body
Name | Required | Type | Description |
---|---|---|---|
action | True |
Specifies the lease action. Can be one of the available actions. |
|
breakPeriod |
integer |
Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. |
|
leaseDuration |
integer |
Required for acquire. Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. |
|
leaseId |
string |
Identifies the lease. Can be specified in any valid GUID string format. |
|
proposedLeaseId |
string |
Optional for acquire, required for change. Proposed lease ID, in a GUID string format. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
OK -- Lease Share operation completed successfully. Headers ETag: string |
|
Other Status Codes |
Error response describing why the operation failed. |
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
Acquire a lease on a share |
Break a lease on a share |
Acquire a lease on a share
Sample request
POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/fileServices/default/shares/share124/lease?api-version=2023-05-01
{
"action": "Acquire",
"leaseId": null,
"breakPeriod": null,
"leaseDuration": -1,
"proposedLeaseId": null
}
Sample response
{
"leaseId": "8698f513-fa75-44a1-b8eb-30ba336af27d"
}
Break a lease on a share
Sample request
POST https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/fileServices/default/shares/share12/lease?api-version=2023-05-01
{
"action": "Break",
"leaseId": "8698f513-fa75-44a1-b8eb-30ba336af27d",
"breakPeriod": null,
"leaseDuration": null,
"proposedLeaseId": null
}
Sample response
{
"leaseTimeSeconds": "0"
}
Definitions
Name | Description |
---|---|
Cloud |
An error response from the Storage service. |
Cloud |
An error response from the Storage service. |
Lease |
Specifies the lease action. Can be one of the available actions. |
Lease |
Lease Share request schema. |
Lease |
Lease Share response schema. |
CloudError
An error response from the Storage service.
Name | Type | Description |
---|---|---|
error |
An error response from the Storage service. |
CloudErrorBody
An error response from the Storage service.
Name | Type | Description |
---|---|---|
code |
string |
An identifier for the error. Codes are invariant and are intended to be consumed programmatically. |
details |
A list of additional details about the error. |
|
message |
string |
A message describing the error, intended to be suitable for display in a user interface. |
target |
string |
The target of the particular error. For example, the name of the property in error. |
LeaseShareAction
Specifies the lease action. Can be one of the available actions.
Name | Type | Description |
---|---|---|
Acquire |
string |
|
Break |
string |
|
Change |
string |
|
Release |
string |
|
Renew |
string |
LeaseShareRequest
Lease Share request schema.
Name | Type | Description |
---|---|---|
action |
Specifies the lease action. Can be one of the available actions. |
|
breakPeriod |
integer |
Optional. For a break action, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. |
leaseDuration |
integer |
Required for acquire. Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. |
leaseId |
string |
Identifies the lease. Can be specified in any valid GUID string format. |
proposedLeaseId |
string |
Optional for acquire, required for change. Proposed lease ID, in a GUID string format. |
LeaseShareResponse
Lease Share response schema.
Name | Type | Description |
---|---|---|
leaseId |
string |
Returned unique lease ID that must be included with any request to delete the share, or to renew, change, or release the lease. |
leaseTimeSeconds |
string |
Approximate time remaining in the lease period, in seconds. |