Lists all shares.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares?api-version=2023-05-01
With optional parameters:
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares?api-version=2023-05-01&$maxpagesize={$maxpagesize}&$filter={$filter}&$expand={$expand}
URI Parameters
Name |
In |
Required |
Type |
Description |
accountName
|
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: ^[a-z0-9]+$
|
resourceGroupName
|
path |
True
|
string
|
The name of the resource group within the user's subscription. The name is case insensitive.
Regex pattern: ^[-\w\._\(\)]+$
|
subscriptionId
|
path |
True
|
string
|
The ID of the target subscription.
|
api-version
|
query |
True
|
string
|
The API version to use for this operation.
|
$expand
|
query |
|
string
|
Optional, used to expand the properties within share's properties. Valid values are: deleted, snapshots. Should be passed as a string with delimiter ','
|
$filter
|
query |
|
string
|
Optional. When specified, only share names starting with the filter will be listed.
|
$maxpagesize
|
query |
|
string
|
Optional. Specified maximum number of shares that can be included in the list.
|
Responses
Name |
Type |
Description |
200 OK
|
FileShareItems
|
OK -- List Shares operation completed successfully.
|
Other Status Codes
|
CloudError
|
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
ListDeletedShares
Sample request
GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares?api-version=2023-05-01&$expand=deleted
/**
* Samples for FileShares List.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/DeletedFileSharesList.json
*/
/**
* Sample code: ListDeletedShares.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void listDeletedShares(com.azure.resourcemanager.AzureResourceManager azure) {
azure.storageAccounts().manager().serviceClient().getFileShares().list("res9290", "sto1590", null, null,
"deleted", 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
from azure.identity import DefaultAzureCredential
from azure.mgmt.storage import StorageManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-storage
# USAGE
python deleted_file_shares_list.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.list(
resource_group_name="res9290",
account_name="sto1590",
)
for item in response:
print(item)
# x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/DeletedFileSharesList.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
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/DeletedFileSharesList.json
func ExampleFileSharesClient_NewListPager_listDeletedShares() {
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)
}
pager := clientFactory.NewFileSharesClient().NewListPager("res9290", "sto1590", &armstorage.FileSharesClientListOptions{Maxpagesize: nil,
Filter: nil,
Expand: to.Ptr("deleted"),
})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.FileShareItems = armstorage.FileShareItems{
// Value: []*armstorage.FileShareItem{
// {
// Name: to.Ptr("share1644"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share1644_1234567890"),
// Etag: to.Ptr("\"0x8D589847D51C7DE\""),
// Properties: &armstorage.FileShareProperties{
// Deleted: to.Ptr(true),
// DeletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-14T08:20:47.000Z"); return t}()),
// LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T08:20:47.000Z"); return t}()),
// RemainingRetentionDays: to.Ptr[int32](30),
// ShareQuota: to.Ptr[int32](1024),
// Version: to.Ptr("1234567890"),
// },
// },
// {
// Name: to.Ptr("share4052"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share4052"),
// Etag: to.Ptr("\"0x8D589847DAB5AF9\""),
// Properties: &armstorage.FileShareProperties{
// LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T08:20:47.000Z"); return t}()),
// ShareQuota: to.Ptr[int32](1024),
// },
// }},
// }
}
}
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 Lists all shares.
*
* @summary Lists all shares.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/DeletedFileSharesList.json
*/
async function listDeletedShares() {
const subscriptionId = process.env["STORAGE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["STORAGE_RESOURCE_GROUP"] || "res9290";
const accountName = "sto1590";
const expand = "deleted";
const options = { expand };
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.fileShares.list(resourceGroupName, accountName, options)) {
resArray.push(item);
}
console.log(resArray);
}
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/DeletedFileSharesList.json
// this example is just showing the usage of "FileShares_List" 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://video2.skills-academy.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 = "res9290";
string accountName = "sto1590";
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 and iterate over the result
string expand = "deleted";
await foreach (FileShareResource item in collection.GetAllAsync(expand: expand))
{
// the variable item 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 = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"value": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share1644_1234567890",
"name": "share1644",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"etag": "\"0x8D589847D51C7DE\"",
"properties": {
"lastModifiedTime": "2019-05-14T08:20:47Z",
"shareQuota": 1024,
"version": "1234567890",
"deleted": true,
"deletedTime": "2019-12-14T08:20:47Z",
"remainingRetentionDays": 30
}
},
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share4052",
"name": "share4052",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"etag": "\"0x8D589847DAB5AF9\"",
"properties": {
"lastModifiedTime": "2019-05-14T08:20:47Z",
"shareQuota": 1024
}
}
]
}
ListShares
Sample request
GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares?api-version=2023-05-01
/**
* Samples for FileShares List.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesList.json
*/
/**
* Sample code: ListShares.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void listShares(com.azure.resourcemanager.AzureResourceManager azure) {
azure.storageAccounts().manager().serviceClient().getFileShares().list("res9290", "sto1590", null, null, 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
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_list.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.list(
resource_group_name="res9290",
account_name="sto1590",
)
for item in response:
print(item)
# x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesList.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
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/FileSharesList.json
func ExampleFileSharesClient_NewListPager_listShares() {
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)
}
pager := clientFactory.NewFileSharesClient().NewListPager("res9290", "sto1590", &armstorage.FileSharesClientListOptions{Maxpagesize: nil,
Filter: nil,
Expand: nil,
})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.FileShareItems = armstorage.FileShareItems{
// Value: []*armstorage.FileShareItem{
// {
// Name: to.Ptr("share1644"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share1644"),
// Etag: to.Ptr("\"0x8D589847D51C7DE\""),
// Properties: &armstorage.FileShareProperties{
// LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T08:20:47.000Z"); return t}()),
// ShareQuota: to.Ptr[int32](1024),
// },
// },
// {
// Name: to.Ptr("share4052"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share4052"),
// Etag: to.Ptr("\"0x8D589847DAB5AF9\""),
// Properties: &armstorage.FileShareProperties{
// LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-14T08:20:47.000Z"); return t}()),
// ShareQuota: to.Ptr[int32](1024),
// },
// }},
// }
}
}
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 Lists all shares.
*
* @summary Lists all shares.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileSharesList.json
*/
async function listShares() {
const subscriptionId = process.env["STORAGE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["STORAGE_RESOURCE_GROUP"] || "res9290";
const accountName = "sto1590";
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.fileShares.list(resourceGroupName, accountName)) {
resArray.push(item);
}
console.log(resArray);
}
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/FileSharesList.json
// this example is just showing the usage of "FileShares_List" 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://video2.skills-academy.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 = "res9290";
string accountName = "sto1590";
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 and iterate over the result
await foreach (FileShareResource item in collection.GetAllAsync())
{
// the variable item 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 = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"value": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share1644",
"name": "share1644",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"etag": "\"0x8D589847D51C7DE\"",
"properties": {
"lastModifiedTime": "2019-05-14T08:20:47Z",
"shareQuota": 1024
}
},
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share4052",
"name": "share4052",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"etag": "\"0x8D589847DAB5AF9\"",
"properties": {
"lastModifiedTime": "2019-05-14T08:20:47Z",
"shareQuota": 1024
}
}
],
"nextLink": "https://sto1590endpoint/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares?api-version=2022-09-01&$maxpagesize=2&$skipToken=/sto1590/share5103"
}
ListShareSnapshots
Sample request
GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares?api-version=2023-05-01&$expand=snapshots
/**
* Samples for FileShares List.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileShareSnapshotsList.json
*/
/**
* Sample code: ListShareSnapshots.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void listShareSnapshots(com.azure.resourcemanager.AzureResourceManager azure) {
azure.storageAccounts().manager().serviceClient().getFileShares().list("res9290", "sto1590", null, null,
"snapshots", 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
from azure.identity import DefaultAzureCredential
from azure.mgmt.storage import StorageManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-storage
# USAGE
python file_share_snapshots_list.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.list(
resource_group_name="res9290",
account_name="sto1590",
)
for item in response:
print(item)
# x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileShareSnapshotsList.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
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/FileShareSnapshotsList.json
func ExampleFileSharesClient_NewListPager_listShareSnapshots() {
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)
}
pager := clientFactory.NewFileSharesClient().NewListPager("res9290", "sto1590", &armstorage.FileSharesClientListOptions{Maxpagesize: nil,
Filter: nil,
Expand: to.Ptr("snapshots"),
})
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.FileShareItems = armstorage.FileShareItems{
// Value: []*armstorage.FileShareItem{
// {
// Name: to.Ptr("share4052"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share4052"),
// Etag: to.Ptr("\"0x8D589847DAB5AF9\""),
// Properties: &armstorage.FileShareProperties{
// LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-26T05:47:05.000Z"); return t}()),
// ShareQuota: to.Ptr[int32](1024),
// },
// },
// {
// Name: to.Ptr("share4052"),
// Type: to.Ptr("Microsoft.Storage/storageAccounts/fileServices/shares"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share4052"),
// Etag: to.Ptr("\"0x8D589847DAB5AF9\""),
// Properties: &armstorage.FileShareProperties{
// LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-26T05:47:05.000Z"); return t}()),
// ShareQuota: to.Ptr[int32](1024),
// SnapshotTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-26T05:48:07.000Z"); return t}()),
// },
// }},
// }
}
}
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 Lists all shares.
*
* @summary Lists all shares.
* x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2023-05-01/examples/FileShareSnapshotsList.json
*/
async function listShareSnapshots() {
const subscriptionId = process.env["STORAGE_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName = process.env["STORAGE_RESOURCE_GROUP"] || "res9290";
const accountName = "sto1590";
const expand = "snapshots";
const options = { expand };
const credential = new DefaultAzureCredential();
const client = new StorageManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.fileShares.list(resourceGroupName, accountName, options)) {
resArray.push(item);
}
console.log(resArray);
}
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/FileShareSnapshotsList.json
// this example is just showing the usage of "FileShares_List" 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://video2.skills-academy.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 = "res9290";
string accountName = "sto1590";
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 and iterate over the result
string expand = "snapshots";
await foreach (FileShareResource item in collection.GetAllAsync(expand: expand))
{
// the variable item 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 = item.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"value": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share4052",
"name": "share4052",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"etag": "\"0x8D589847DAB5AF9\"",
"properties": {
"lastModifiedTime": "2020-10-26T05:47:05.0000000Z",
"shareQuota": 1024
}
},
{
"id": "/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/fileServices/default/shares/share4052",
"name": "share4052",
"type": "Microsoft.Storage/storageAccounts/fileServices/shares",
"etag": "\"0x8D589847DAB5AF9\"",
"properties": {
"lastModifiedTime": "2020-10-26T05:47:05.0000000Z",
"shareQuota": 1024,
"snapshotTime": "2020-10-26T05:48:07.0000000Z"
}
}
]
}
Definitions
Name |
Description |
AccessPolicy
|
|
CloudError
|
An error response from the Storage service.
|
CloudErrorBody
|
An error response from the Storage service.
|
EnabledProtocols
|
The authentication protocol that is used for the file share. Can only be specified when creating a share.
|
FileShareItem
|
The file share properties be listed out.
|
FileShareItems
|
Response schema. Contains list of shares returned, and if paging is requested or required, a URL to next page of shares.
|
LeaseDuration
|
Specifies whether the lease on a share is of infinite or fixed duration, only when the share is leased.
|
LeaseState
|
Lease state of the share.
|
LeaseStatus
|
The lease status of the share.
|
RootSquashType
|
The property is for NFS share only. The default is NoRootSquash.
|
ShareAccessTier
|
Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium.
|
SignedIdentifier
|
|
AccessPolicy
Name |
Type |
Description |
expiryTime
|
string
|
Expiry time of the access policy
|
permission
|
string
|
List of abbreviated permissions.
|
startTime
|
string
|
Start time of the access policy
|
CloudError
An error response from the Storage service.
Name |
Type |
Description |
error
|
CloudErrorBody
|
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
|
CloudErrorBody[]
|
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.
|
EnabledProtocols
The authentication protocol that is used for the file share. Can only be specified when creating a share.
Name |
Type |
Description |
NFS
|
string
|
|
SMB
|
string
|
|
FileShareItem
The file share properties be listed out.
Name |
Type |
Description |
etag
|
string
|
Resource Etag.
|
id
|
string
|
Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
name
|
string
|
The name of the resource
|
properties.accessTier
|
ShareAccessTier
|
Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium.
|
properties.accessTierChangeTime
|
string
|
Indicates the last modification time for share access tier.
|
properties.accessTierStatus
|
string
|
Indicates if there is a pending transition for access tier.
|
properties.deleted
|
boolean
|
Indicates whether the share was deleted.
|
properties.deletedTime
|
string
|
The deleted time if the share was deleted.
|
properties.enabledProtocols
|
EnabledProtocols
|
The authentication protocol that is used for the file share. Can only be specified when creating a share.
|
properties.lastModifiedTime
|
string
|
Returns the date and time the share was last modified.
|
properties.leaseDuration
|
LeaseDuration
|
Specifies whether the lease on a share is of infinite or fixed duration, only when the share is leased.
|
properties.leaseState
|
LeaseState
|
Lease state of the share.
|
properties.leaseStatus
|
LeaseStatus
|
The lease status of the share.
|
properties.metadata
|
object
|
A name-value pair to associate with the share as metadata.
|
properties.remainingRetentionDays
|
integer
|
Remaining retention days for share that was soft deleted.
|
properties.rootSquash
|
RootSquashType
|
The property is for NFS share only. The default is NoRootSquash.
|
properties.shareQuota
|
integer
|
The maximum size of the share, in gigabytes. Must be greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400.
|
properties.shareUsageBytes
|
integer
|
The approximate size of the data stored on the share. Note that this value may not include all recently created or recently resized files.
|
properties.signedIdentifiers
|
SignedIdentifier[]
|
List of stored access policies specified on the share.
|
properties.snapshotTime
|
string
|
Creation time of share snapshot returned in the response of list shares with expand param "snapshots".
|
properties.version
|
string
|
The version of the share.
|
type
|
string
|
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
|
FileShareItems
Response schema. Contains list of shares returned, and if paging is requested or required, a URL to next page of shares.
Name |
Type |
Description |
nextLink
|
string
|
Request URL that can be used to query next page of shares. Returned when total number of requested shares exceed maximum page size.
|
value
|
FileShareItem[]
|
List of file shares returned.
|
LeaseDuration
Specifies whether the lease on a share is of infinite or fixed duration, only when the share is leased.
Name |
Type |
Description |
Fixed
|
string
|
|
Infinite
|
string
|
|
LeaseState
Lease state of the share.
Name |
Type |
Description |
Available
|
string
|
|
Breaking
|
string
|
|
Broken
|
string
|
|
Expired
|
string
|
|
Leased
|
string
|
|
LeaseStatus
The lease status of the share.
Name |
Type |
Description |
Locked
|
string
|
|
Unlocked
|
string
|
|
RootSquashType
The property is for NFS share only. The default is NoRootSquash.
Name |
Type |
Description |
AllSquash
|
string
|
|
NoRootSquash
|
string
|
|
RootSquash
|
string
|
|
ShareAccessTier
Access tier for specific share. GpV2 account can choose between TransactionOptimized (default), Hot, and Cool. FileStorage account can choose Premium.
Name |
Type |
Description |
Cool
|
string
|
|
Hot
|
string
|
|
Premium
|
string
|
|
TransactionOptimized
|
string
|
|
SignedIdentifier
Name |
Type |
Description |
accessPolicy
|
AccessPolicy
|
Access policy
|
id
|
string
|
An unique identifier of the stored access policy.
|