你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

az storage share-rm

使用 Microsoft 管理 Azure 文件共享。存储资源提供程序。

命令

名称 说明 类型 状态
az storage share-rm create

在指定的存储帐户下创建新的 Azure 文件共享。

核心 GA
az storage share-rm delete

删除指定的 Azure 文件共享或共享快照。

核心 GA
az storage share-rm exists

检查是否存在 Azure 文件共享。

核心 GA
az storage share-rm list

列出指定存储帐户下的 Azure 文件共享。

核心 GA
az storage share-rm restore

如果启用了共享软删除,在有效的保留期内还原文件共享。

核心 GA
az storage share-rm show

显示指定 Azure 文件共享或共享快照的属性。

核心 GA
az storage share-rm snapshot

在指定帐户下创建现有共享的快照。

核心 预览
az storage share-rm stats

获取共享上存储的数据的使用字节数。

核心 GA
az storage share-rm update

更新 Azure 文件共享的属性。

核心 GA

az storage share-rm create

在指定的存储帐户下创建新的 Azure 文件共享。

az storage share-rm create --name
                           --storage-account
                           [--access-tier {Cool, Hot, Premium, TransactionOptimized}]
                           [--enabled-protocols {NFS, SMB}]
                           [--metadata]
                           [--quota]
                           [--resource-group]
                           [--root-squash {AllSquash, NoRootSquash, RootSquash}]

示例

在资源组“MyResourceGroup”中的存储帐户“mystorageaccount”(帐户名称)下创建一个新的 Azure 文件共享“myfileshare”,其元数据和配额为 10 GB。

az storage share-rm create -g MyResourceGroup --storage-account mystorageaccount --name myfileshare --quota 10 --metadata key1=value1 key2=value2

在存储帐户“mystorageaccount”(帐户名称)下创建一个新的 Azure 文件共享“myfileshare”,其元数据和配额为 6000 GB,可在资源组“MyResourceGroup”中启用大型文件共享。

az storage account update -g MyResourceGroup --name mystorageaccount --enable-large-file-share
az storage share-rm create -g MyResourceGroup --storage-account mystorageaccount --name myfileshare --quota 6000 --metadata key1=value1 key2=value2

在存储帐户“mystorageaccount”(帐户 ID)下创建一个新的 Azure 文件共享“myfileshare”,其元数据和配额为 10 GB。

az storage share-rm create --storage-account mystorageaccount --name myfileshare --quota 10 --metadata key1=value1 key2=value2

必需参数

--name -n

文件共享名称。

--storage-account

存储帐户的名称或 ID。

可选参数

--access-tier

特定共享的访问层。 GpV2 帐户可以在 TransactionOptimized(默认)、热和冷之间进行选择。 文件存储帐户可以选择高级版。

接受的值: Cool, Hot, Premium, TransactionOptimized
--enabled-protocols

文件共享协议的不可变属性。 NFS 协议仅适用于高级文件共享(文件中的文件共享存储帐户类型)。

接受的值: NFS, SMB
--metadata

与共享关联的空格分隔键=值对中的元数据。 这会覆盖任何现有元数据。

--quota -q

共享的最大大小(以 GB 为单位)。 必须大于 0,并且小于或等于 5TB (5120)。 对于大型文件共享,最大大小为 102400。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--root-squash

减少远程超级用户的访问权限。

接受的值: AllSquash, NoRootSquash, RootSquash
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az storage share-rm delete

删除指定的 Azure 文件共享或共享快照。

中断性变更:默认情况下无法删除快照,如果想要包括用于删除操作的 sanpshots,我们添加了要使用的新参数。

az storage share-rm delete [--ids]
                           [--include]
                           [--name]
                           [--resource-group]
                           [--snapshot]
                           [--storage-account]
                           [--subscription]
                           [--yes]

示例

删除资源组“MyResourceGroup”中的存储帐户“mystorageaccount”(帐户名称)下的 Azure 文件共享“myfileshare”。

az storage share-rm delete -g MyResourceGroup --storage-account mystorageaccount --name myfileshare

删除存储帐户“mystorageaccount”(帐户 ID)下的 Azure 文件共享“myfileshare”。

az storage share-rm delete --storage-account mystorageaccount --name myfileshare

按资源 ID 删除 Azure 文件共享。

az storage share-rm delete --ids file-share-id

删除 Azure 文件共享快照。

az storage share-rm delete --ids file-share-id --snapshot "2021-03-25T05:29:56.0000000Z"

删除 Azure 文件共享及其所有快照。

az storage share-rm delete --include snapshots -g MyResourceGroup --storage-account mystorageaccount --name myfileshare

删除 Azure 文件共享及其所有快照(已租用/未发布)。

az storage share-rm delete --include leased-snapshots -g MyResourceGroup --storage-account mystorageaccount --name myfileshare

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--include

可选。 有效值为:快照、租用快照、无。 默认值为 快照。 对于“快照”,文件共享将被删除,包括其所有文件共享快照。 如果文件共享包含租约快照,则删除会失败。 对于“leased-快照s”,文件共享将被删除,其中包含其所有文件共享快照(租用/未发布)。 对于“none”,如果文件共享没有共享快照,则会删除文件共享。 如果文件共享包含任何快照(租用或未发布),则删除将失败。 默认值为 None。

默认值: none
--name -n

文件共享名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--snapshot
预览

指定要检索的共享快照的 DateTime 值。

--storage-account

存储帐户的名称或 ID。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--yes -y

不提示确认。

默认值: False
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az storage share-rm exists

检查是否存在 Azure 文件共享。

az storage share-rm exists [--ids]
                           [--name]
                           [--resource-group]
                           [--storage-account]
                           [--subscription]

示例

检查资源组“MyResourceGroup”中存储帐户“mystorageaccount”(帐户名)下是否存在 Azure 文件共享“myfileshare”。

az storage share-rm exists -g MyResourceGroup --storage-account mystorageaccount --name myfileshare

检查存储帐户“mystorageaccount”(帐户 ID)下是否存在 Azure 文件共享“myfileshare”。

az storage share-rm exists --storage-account mystorageaccount --name myfileshare

按资源 ID 检查是否存在 Azure 文件共享。

az storage share-rm exists --ids file-share-id

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--name -n

文件共享名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--storage-account

存储帐户的名称或 ID。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az storage share-rm list

列出指定存储帐户下的 Azure 文件共享。

az storage share-rm list --storage-account
                         [--include-deleted]
                         [--include-snapshot]
                         [--resource-group]

示例

列出资源组“MyResourceGroup”中存储帐户“mystorageaccount”(帐户名称)下的 Azure 文件共享。

az storage share-rm list -g MyResourceGroup --storage-account mystorageaccount

列出存储帐户“mystorageaccount”(帐户 ID)下的 Azure 文件共享。

az storage share-rm list --storage-account mystorageaccount

列出所有文件共享,包括在存储帐户“mystorageaccount”下删除。

az storage share-rm list --storage-account mystorageaccount --include-deleted

列出所有文件共享在其存储帐户“mystorageaccount”下的所有快照。

az storage share-rm list --storage-account mystorageaccount --include-snapshot

列出所有文件共享,包括其所有快照和已删除的文件共享,在存储帐户“mystorageaccount”下。

az storage share-rm list --storage-account mystorageaccount --include-deleted --include-snapshot

必需参数

--storage-account

存储帐户的名称或 ID。

可选参数

--include-deleted

指定时包括软删除的文件共享。

--include-snapshot

指定时包括文件共享快照。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az storage share-rm restore

如果启用了共享软删除,在有效的保留期内还原文件共享。

az storage share-rm restore --deleted-version
                            [--ids]
                            [--name]
                            [--resource-group]
                            [--restored-name]
                            [--storage-account]
                            [--subscription]

示例

如果启用了共享软删除,在有效的保留期内还原文件共享。

az storage share-rm restore -n deletedshare --deleted-version 01D64EB9886F00C4 -g MyResourceGroup --storage-account mystorageaccount

如果共享软删除已启用新名称,在有效的保留期内还原文件共享。

az storage share-rm restore -n deletedshare --deleted-version 01D64EB9886F00C4 --restored-name newname -g MyResourceGroup --storage-account mystorageaccount

必需参数

--deleted-version

标识将还原的已删除共享的版本。

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--name -n

文件共享名称。 标识将还原的已删除共享的名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--restored-name

要还原的新文件共享名称。 如果未指定,将使用已删除的共享名称。

--storage-account

存储帐户的名称或 ID。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az storage share-rm show

显示指定 Azure 文件共享或共享快照的属性。

az storage share-rm show [--expand]
                         [--ids]
                         [--name]
                         [--resource-group]
                         [--snapshot]
                         [--storage-account]
                         [--subscription]

示例

显示资源组“MyResourceGroup”中存储帐户“mystorageaccount”(帐户名称)下的 Azure 文件共享“myfileshare”的属性。

az storage share-rm show -g MyResourceGroup --storage-account mystorageaccount --name myfileshare

显示存储帐户“mystorageaccount”(帐户 ID)下 Azure 文件共享“myfileshare”的属性。

az storage share-rm show --storage-account mystorageaccount --name myfileshare

按资源 ID 显示 Azure 文件共享的属性。

az storage share-rm show --ids file-share-id

显示 Azure 文件共享快照的属性

az storage share-rm show --ids file-share-id --snapshot "2021-03-25T05:29:56.0000000Z"

可选参数

--expand

可选,用于扩展共享属性中的属性。 有效值为:统计信息。应作为带分隔符“,”的字符串传递。 默认值为 None。

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--name -n

文件共享名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--snapshot
预览

指定要检索的共享快照的 DateTime 值。

--storage-account

存储帐户的名称或 ID。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az storage share-rm snapshot

预览

此命令处于预览阶段,正在开发中。 参考和支持级别: https://aka.ms/CLI_refstatus

在指定帐户下创建现有共享的快照。

az storage share-rm snapshot [--access-tier {Cool, Hot, Premium, TransactionOptimized}]
                             [--enabled-protocols {NFS, SMB}]
                             [--ids]
                             [--metadata]
                             [--name]
                             [--quota]
                             [--resource-group]
                             [--root-squash {AllSquash, NoRootSquash, RootSquash}]
                             [--storage-account]
                             [--subscription]

示例

在指定帐户下创建现有共享的快照。

az storage share-rm snapshot -g MyResourceGroup --storage-account mystorageaccount --name myfileshare

可选参数

--access-tier

特定共享的访问层。 GpV2 帐户可以在 TransactionOptimized(默认)、热和冷之间进行选择。 文件存储帐户可以选择高级版。

接受的值: Cool, Hot, Premium, TransactionOptimized
--enabled-protocols

文件共享协议的不可变属性。 NFS 协议仅适用于高级文件共享(文件中的文件共享存储帐户类型)。

接受的值: NFS, SMB
--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--metadata

与共享关联的空格分隔键=值对中的元数据。 这会覆盖任何现有元数据。

--name -n

文件共享名称。

--quota -q

共享的最大大小(以 GB 为单位)。 必须大于 0,并且小于或等于 5TB (5120)。 对于大型文件共享,最大大小为 102400。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--root-squash

减少远程超级用户的访问权限。

接受的值: AllSquash, NoRootSquash, RootSquash
--storage-account

存储帐户的名称或 ID。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az storage share-rm stats

获取共享上存储的数据的使用字节数。

az storage share-rm stats [--ids]
                          [--name]
                          [--resource-group]
                          [--storage-account]
                          [--subscription]

示例

获取共享上存储的数据的使用字节数。

az storage share-rm stats -g MyResourceGroup --storage-account mystorageaccount --name myfileshare

可选参数

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--name -n

文件共享名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--storage-account

存储帐户的名称或 ID。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az storage share-rm update

更新 Azure 文件共享的属性。

az storage share-rm update [--access-tier {Cool, Hot, Premium, TransactionOptimized}]
                           [--add]
                           [--force-string]
                           [--ids]
                           [--metadata]
                           [--name]
                           [--quota]
                           [--remove]
                           [--resource-group]
                           [--root-squash {AllSquash, NoRootSquash, RootSquash}]
                           [--set]
                           [--storage-account]
                           [--subscription]

示例

更新资源组“MyResourceGroup”中存储帐户“mystorageaccount”(帐户名)下的 Azure 文件共享“myfileshare”的属性。

az storage share-rm update -g MyResourceGroup --storage-account mystorageaccount --name myfileshare --quota 3 --metadata key1=value1 key2=value2

更新存储帐户“mystorageaccount”(帐户 ID)下 Azure 文件共享“myfileshare”的属性。

az storage share-rm update --storage-account mystorageaccount --name myfileshare --quota 3 --metadata key1=value1 key2=value2

按资源 ID 更新 Azure 文件共享的属性。

az storage share-rm update --ids file-share-id --quota 3 --metadata key1=value1 key2=value2

可选参数

--access-tier

特定共享的访问层。 GpV2 帐户可以在 TransactionOptimized(默认)、热和冷之间进行选择。 文件存储帐户可以选择高级版。

接受的值: Cool, Hot, Premium, TransactionOptimized
--add

通过指定路径和键值对将对象添加到对象列表。 示例:--add property.listProperty <key=value, string or JSON string>

默认值: []
--force-string

使用“set”或“add”时,保留字符串文本,而不是尝试转换为 JSON。

默认值: False
--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“资源 ID”参数的所有信息的完整资源 ID。 应提供 --id 或其他“资源 ID”参数。

--metadata

与共享关联的空格分隔键=值对中的元数据。 这会覆盖任何现有元数据。

--name -n

文件共享名称。

--quota -q

共享的最大大小(以 GB 为单位)。 必须大于 0,并且小于或等于 5TB (5120)。 对于大型文件共享,最大大小为 102400。

--remove

从列表中删除属性或元素。 示例: --remove property.list <indexToRemove> OR --remove propertyToRemove.

默认值: []
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--root-squash

减少远程超级用户的访问权限。

接受的值: AllSquash, NoRootSquash, RootSquash
--set

通过指定要设置的属性路径和值来更新对象。 示例:--set property1.property2=<value>

默认值: []
--storage-account

存储帐户的名称或 ID。

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。