依照要求本文所述,在指定的帳戶下建立新的共用。 共用資源包含該共用的元數據和屬性。 它不包含共用所包含的檔案清單。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}?api-version=2023-05-01
含選擇性參數:
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}?$expand={$expand}&api-version=2023-05-01
URI 參數
名稱 |
位於 |
必要 |
類型 |
Description |
accountName
|
path |
True
|
string
|
指定資源群組內的記憶體帳戶名稱。 儲存體帳戶名稱長度必須介於 3 到 24 個字元之間,且只能使用數位和小寫字母。
Regex 模式: ^[a-z0-9]+$
|
resourceGroupName
|
path |
True
|
string
|
用戶訂用帳戶內的資源組名。 名稱不區分大小寫。
Regex 模式: ^[-\w\._\(\)]+$
|
shareName
|
path |
True
|
string
|
指定記憶體帳戶內的檔案共享名稱。 檔案共享名稱的長度必須介於 3 到 63 個字元之間,且只能使用數位、小寫字母和虛線 (-) 。 每個虛線 (-) 字元必須緊接在前面,後面接著字母或數位。
|
subscriptionId
|
path |
True
|
string
|
目標訂用帳戶的標識碼。
|
api-version
|
query |
True
|
string
|
要用於這項作業的 API 版本。
|
$expand
|
query |
|
string
|
選擇性,用來展開共用屬性內的屬性。 有效值為:快照集。 應該以具有分隔符 ', 的字串傳遞
|
要求本文
名稱 |
類型 |
Description |
properties.accessTier
|
ShareAccessTier
|
特定共用的存取層。 GpV2 帳戶可以選擇 TransactionOptimized (預設)、經常性存取和非經常性存取。 FileStorage 帳戶可以選擇 [進階]。
|
properties.enabledProtocols
|
EnabledProtocols
|
用於檔案共用的驗證通訊協定。 只能在建立共用時指定。
|
properties.metadata
|
object
|
要與共用建立關聯的名稱/值組做為元數據。
|
properties.rootSquash
|
RootSquashType
|
屬性僅適用於 NFS 共用。 預設值為 NoRootSquash。
|
properties.shareQuota
|
integer
|
共用的大小上限,以 GB 為單位。 必須大於 0,且小於或等於 5TB (5120)。 對於大型檔案共用,大小上限為 102400。
|
properties.signedIdentifiers
|
SignedIdentifier[]
|
共用上指定的預存存取原則清單。
|
回應
安全性
azure_auth
Azure Active Directory OAuth2 Flow
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/authorize
範圍
名稱 |
Description |
user_impersonation
|
模擬您的用戶帳戶
|
範例
Create NFS Shares
範例要求
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res346/providers/Microsoft.Storage/storageAccounts/sto666/fileServices/default/shares/share1235?api-version=2023-05-01
{
"properties": {
"enabledProtocols": "NFS"
}
}
import com.azure.resourcemanager.storage.fluent.models.FileShareInner;
import com.azure.resourcemanager.storage.models.EnabledProtocols;
/**
* Samples for FileShares Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_NFS.json
*/
/**
* Sample code: Create NFS Shares.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void createNFSShares(com.azure.resourcemanager.AzureResourceManager azure) {
azure.storageAccounts().manager().serviceClient().getFileShares().createWithResponse("res346", "sto666",
"share1235", new FileShareInner().withEnabledProtocols(EnabledProtocols.NFS), null,
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armstorage_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/220ad9c6554fc7d6d10a89bdb441c1e3b36e3285/specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_NFS.json
func ExampleFileSharesClient_Create_createNfsShares() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armstorage.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewFileSharesClient().Create(ctx, "res346", "sto666", "share1235", armstorage.FileShare{
FileShareProperties: &armstorage.FileShareProperties{
EnabledProtocols: to.Ptr(armstorage.EnabledProtocolsNFS),
},
}, &armstorage.FileSharesClientCreateOptions{Expand: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.FileShare = armstorage.FileShare{
// Name: to.Ptr("share1235"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res346/providers/Microsoft.Storage/storageAccounts/sto666/fileServices/default/shares/share1235"),
// FileShareProperties: &armstorage.FileShareProperties{
// EnabledProtocols: to.Ptr(armstorage.EnabledProtocolsNFS),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { StorageManagementClient } = require("@azure/arm-storage");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share.
*
* @summary Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_NFS.json
*/
async function createNfsShares() {
const subscriptionId = process.env["STORAGE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["STORAGE_RESOURCE_GROUP"] || "res346";
const accountName = "sto666";
const shareName = "share1235";
const fileShare = { enabledProtocols: "NFS" };
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = await client.fileShares.create(
resourceGroupName,
accountName,
shareName,
fileShare,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Storage.Models;
using Azure.ResourceManager.Storage;
// Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_NFS.json
// this example is just showing the usage of "FileShares_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this FileServiceResource created on azure
// for more information of creating FileServiceResource, please refer to the document of FileServiceResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "res346";
string accountName = "sto666";
ResourceIdentifier fileServiceResourceId = FileServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
FileServiceResource fileService = client.GetFileServiceResource(fileServiceResourceId);
// get the collection of this FileShareResource
FileShareCollection collection = fileService.GetFileShares();
// invoke the operation
string shareName = "share1235";
FileShareData data = new FileShareData()
{
EnabledProtocol = FileShareEnabledProtocol.Nfs,
};
ArmOperation<FileShareResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, shareName, data);
FileShareResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
FileShareData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.storage import StorageManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-storage
# USAGE
python file_shares_put_nfs.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = StorageManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.file_shares.create(
resource_group_name="res346",
account_name="sto666",
share_name="share1235",
file_share={"properties": {"enabledProtocols": "NFS"}},
)
print(response)
# x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_NFS.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res346/providers/Microsoft.Storage/storageAccounts/sto666/fileServices/default/shares/share1235",
"name": "share1235",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"properties": {
"enabledProtocols": "NFS"
}
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res346/providers/Microsoft.Storage/storageAccounts/sto666/fileServices/default/shares/share1235",
"name": "share1235",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"properties": {
"enabledProtocols": "NFS"
}
}
PutShares
範例要求
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/fileServices/default/shares/share6185?api-version=2023-05-01
{}
import com.azure.resourcemanager.storage.fluent.models.FileShareInner;
/**
* Samples for FileShares Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut.json
*/
/**
* Sample code: PutShares.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void putShares(com.azure.resourcemanager.AzureResourceManager azure) {
azure.storageAccounts().manager().serviceClient().getFileShares().createWithResponse("res3376", "sto328",
"share6185", new FileShareInner(), null, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armstorage_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/220ad9c6554fc7d6d10a89bdb441c1e3b36e3285/specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut.json
func ExampleFileSharesClient_Create_putShares() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armstorage.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewFileSharesClient().Create(ctx, "res3376", "sto328", "share6185", armstorage.FileShare{}, &armstorage.FileSharesClientCreateOptions{Expand: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.FileShare = armstorage.FileShare{
// Name: to.Ptr("share6185"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/fileServices/default/shares/share6185"),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { StorageManagementClient } = require("@azure/arm-storage");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share.
*
* @summary Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut.json
*/
async function putShares() {
const subscriptionId = process.env["STORAGE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["STORAGE_RESOURCE_GROUP"] || "res3376";
const accountName = "sto328";
const shareName = "share6185";
const fileShare = {};
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = await client.fileShares.create(
resourceGroupName,
accountName,
shareName,
fileShare,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Storage.Models;
using Azure.ResourceManager.Storage;
// Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut.json
// this example is just showing the usage of "FileShares_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this FileServiceResource created on azure
// for more information of creating FileServiceResource, please refer to the document of FileServiceResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "res3376";
string accountName = "sto328";
ResourceIdentifier fileServiceResourceId = FileServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
FileServiceResource fileService = client.GetFileServiceResource(fileServiceResourceId);
// get the collection of this FileShareResource
FileShareCollection collection = fileService.GetFileShares();
// invoke the operation
string shareName = "share6185";
FileShareData data = new FileShareData();
ArmOperation<FileShareResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, shareName, data);
FileShareResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
FileShareData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/fileServices/default/shares/share6185",
"name": "share6185",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares"
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/fileServices/default/shares/share6185",
"name": "share6185",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares"
}
PutShares with Access Tier
範例要求
PUT https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res346/providers/Microsoft.Storage/storageAccounts/sto666/fileServices/default/shares/share1235?api-version=2023-05-01
{
"properties": {
"accessTier": "Hot"
}
}
import com.azure.resourcemanager.storage.fluent.models.FileShareInner;
import com.azure.resourcemanager.storage.models.ShareAccessTier;
/**
* Samples for FileShares Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_AccessTier.json
*/
/**
* Sample code: PutShares with Access Tier.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void putSharesWithAccessTier(com.azure.resourcemanager.AzureResourceManager azure) {
azure.storageAccounts().manager().serviceClient().getFileShares().createWithResponse("res346", "sto666",
"share1235", new FileShareInner().withAccessTier(ShareAccessTier.HOT), null,
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armstorage_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/220ad9c6554fc7d6d10a89bdb441c1e3b36e3285/specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_AccessTier.json
func ExampleFileSharesClient_Create_putSharesWithAccessTier() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armstorage.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewFileSharesClient().Create(ctx, "res346", "sto666", "share1235", armstorage.FileShare{
FileShareProperties: &armstorage.FileShareProperties{
AccessTier: to.Ptr(armstorage.ShareAccessTierHot),
},
}, &armstorage.FileSharesClientCreateOptions{Expand: nil})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.FileShare = armstorage.FileShare{
// Name: to.Ptr("share1235"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res346/providers/Microsoft.Storage/storageAccounts/sto666/fileServices/default/shares/share1235"),
// FileShareProperties: &armstorage.FileShareProperties{
// AccessTier: to.Ptr(armstorage.ShareAccessTierHot),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { StorageManagementClient } = require("@azure/arm-storage");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share.
*
* @summary Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_AccessTier.json
*/
async function putSharesWithAccessTier() {
const subscriptionId = process.env["STORAGE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["STORAGE_RESOURCE_GROUP"] || "res346";
const accountName = "sto666";
const shareName = "share1235";
const fileShare = { accessTier: "Hot" };
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const result = await client.fileShares.create(
resourceGroupName,
accountName,
shareName,
fileShare,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Storage.Models;
using Azure.ResourceManager.Storage;
// Generated from example definition: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_AccessTier.json
// this example is just showing the usage of "FileShares_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this FileServiceResource created on azure
// for more information of creating FileServiceResource, please refer to the document of FileServiceResource
string subscriptionId = "{subscription-id}";
string resourceGroupName = "res346";
string accountName = "sto666";
ResourceIdentifier fileServiceResourceId = FileServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
FileServiceResource fileService = client.GetFileServiceResource(fileServiceResourceId);
// get the collection of this FileShareResource
FileShareCollection collection = fileService.GetFileShares();
// invoke the operation
string shareName = "share1235";
FileShareData data = new FileShareData()
{
AccessTier = FileShareAccessTier.Hot,
};
ArmOperation<FileShareResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, shareName, data);
FileShareResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
FileShareData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from typing import Any, IO, Union
from azure.identity import DefaultAzureCredential
from azure.mgmt.storage import StorageManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-storage
# USAGE
python file_shares_put_access_tier.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = StorageManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.file_shares.create(
resource_group_name="res346",
account_name="sto666",
share_name="share1235",
file_share={"properties": {"accessTier": "Hot"}},
)
print(response)
# x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesPut_AccessTier.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res346/providers/Microsoft.Storage/storageAccounts/sto666/fileServices/default/shares/share1235",
"name": "share1235",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"properties": {
"accessTier": "Hot"
}
}
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res346/providers/Microsoft.Storage/storageAccounts/sto666/fileServices/default/shares/share1235",
"name": "share1235",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"properties": {
"accessTier": "Hot"
}
}
定義
AccessPolicy
名稱 |
類型 |
Description |
expiryTime
|
string
|
存取原則的到期時間
|
permission
|
string
|
縮寫許可權的清單。
|
startTime
|
string
|
存取原則的開始時間
|
CloudError
記憶體服務的錯誤回應。
CloudErrorBody
記憶體服務的錯誤回應。
名稱 |
類型 |
Description |
code
|
string
|
錯誤的識別碼。 程序代碼是不變的,而且是要以程序設計方式取用。
|
details
|
CloudErrorBody[]
|
錯誤的其他詳細數據清單。
|
message
|
string
|
描述錯誤的訊息,適用於在使用者介面中顯示。
|
target
|
string
|
特定錯誤的目標。 例如,錯誤中的屬性名稱。
|
EnabledProtocols
用於檔案共用的驗證通訊協定。 只能在建立共用時指定。
名稱 |
類型 |
Description |
NFS
|
string
|
|
SMB
|
string
|
|
FileShare
檔案共享的屬性,包括標識符、資源名稱、資源類型、Etag。
名稱 |
類型 |
Description |
etag
|
string
|
資源 Etag。
|
id
|
string
|
資源的完整資源標識碼。 例如 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
資源的名稱
|
properties.accessTier
|
ShareAccessTier
|
特定共用的存取層。 GpV2 帳戶可以選擇 TransactionOptimized (預設)、經常性存取和非經常性存取。 FileStorage 帳戶可以選擇 [進階]。
|
properties.accessTierChangeTime
|
string
|
表示共用存取層的最後一次修改時間。
|
properties.accessTierStatus
|
string
|
指出存取層是否有暫止轉換。
|
properties.deleted
|
boolean
|
指出是否已刪除共用。
|
properties.deletedTime
|
string
|
已刪除共享的時間。
|
properties.enabledProtocols
|
EnabledProtocols
|
用於檔案共用的驗證通訊協定。 只能在建立共用時指定。
|
properties.lastModifiedTime
|
string
|
傳回上次修改共用的日期和時間。
|
properties.leaseDuration
|
LeaseDuration
|
指定共用上的租用是否為無限或固定的持續時間,只有在共用租用時。
|
properties.leaseState
|
LeaseState
|
共用的租用狀態。
|
properties.leaseStatus
|
LeaseStatus
|
共用的租用狀態。
|
properties.metadata
|
object
|
要與共用建立關聯的名稱/值組做為元數據。
|
properties.remainingRetentionDays
|
integer
|
虛刪除共享的剩餘保留天數。
|
properties.rootSquash
|
RootSquashType
|
屬性僅適用於 NFS 共用。 預設值為 NoRootSquash。
|
properties.shareQuota
|
integer
|
共用的大小上限,以 GB 為單位。 必須大於 0,且小於或等於 5TB (5120)。 對於大型檔案共用,大小上限為 102400。
|
properties.shareUsageBytes
|
integer
|
儲存在共用上的大約數據大小。 請注意,此值可能不會包含最近建立或最近重設大小的檔案。
|
properties.signedIdentifiers
|
SignedIdentifier[]
|
共用上指定的預存存取原則清單。
|
properties.snapshotTime
|
string
|
使用展開參數「快照集」,在清單共用響應中傳回的共用快照集建立時間。
|
properties.version
|
string
|
共用的版本。
|
type
|
string
|
資源的型別。 例如“Microsoft.Compute/virtualMachines” 或 “Microsoft.Storage/storageAccounts”
|
LeaseDuration
指定共用上的租用是否為無限或固定的持續時間,只有在共用租用時。
名稱 |
類型 |
Description |
Fixed
|
string
|
|
Infinite
|
string
|
|
LeaseState
共用的租用狀態。
名稱 |
類型 |
Description |
Available
|
string
|
|
Breaking
|
string
|
|
Broken
|
string
|
|
Expired
|
string
|
|
Leased
|
string
|
|
LeaseStatus
共用的租用狀態。
名稱 |
類型 |
Description |
Locked
|
string
|
|
Unlocked
|
string
|
|
RootSquashType
屬性僅適用於 NFS 共用。 預設值為 NoRootSquash。
名稱 |
類型 |
Description |
AllSquash
|
string
|
|
NoRootSquash
|
string
|
|
RootSquash
|
string
|
|
ShareAccessTier
特定共用的存取層。 GpV2 帳戶可以選擇 TransactionOptimized (預設)、經常性存取和非經常性存取。 FileStorage 帳戶可以選擇 [進階]。
名稱 |
類型 |
Description |
Cool
|
string
|
|
Hot
|
string
|
|
Premium
|
string
|
|
TransactionOptimized
|
string
|
|
SignedIdentifier
名稱 |
類型 |
Description |
accessPolicy
|
AccessPolicy
|
存取原則
|
id
|
string
|
預存存取原則的唯一標識符。
|