Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/fileshares/HISTORY.rst → src/fileshare/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
Release History
===============

1.0.0b1
1.0.0
++++++
* Initial release.
* Support for managing Azure File Shares resources using API version ``2025-09-01-preview``.
* GA release.
* Support for managing Azure File Shares resources using API version ``2026-06-01``.
* Commands for file share CRUD operations: ``az fileshare create/show/list/update/delete``.
* Check file share name availability: ``az fileshare check-name-availability``.
* View file share limits and provisioning recommendations: ``az fileshare limits-show``, ``az fileshare get-provisioning-recommendation``.
Expand Down
2 changes: 1 addition & 1 deletion src/fileshares/README.md → src/fileshare/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Manage Azure File Shares resources (API version `2025-09-01-preview`).
## Install

```bash
az extension add --name fileshares
az extension add --name fileshare
```

## Usage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
# --------------------------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from azext_fileshares._help import helps # pylint: disable=unused-import
from azext_fileshare._help import helps # pylint: disable=unused-import


class FilesharesCommandsLoader(AzCommandsLoader):
class FileshareCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
custom_command_type = CliCommandType(
operations_tmpl='azext_fileshares.custom#{}')
operations_tmpl='azext_fileshare.custom#{}')
super().__init__(cli_ctx=cli_ctx,
custom_command_type=custom_command_type)

def load_command_table(self, args):
from azext_fileshares.commands import load_command_table
from azext_fileshare.commands import load_command_table
from azure.cli.core.aaz import load_aaz_command_table
try:
from . import aaz
Expand All @@ -35,8 +35,8 @@ def load_command_table(self, args):
return self.command_table

def load_arguments(self, command):
from azext_fileshares._params import load_arguments
from azext_fileshare._params import load_arguments
load_arguments(self, command)


COMMAND_LOADER_CLS = FilesharesCommandsLoader
COMMAND_LOADER_CLS = FileshareCommandsLoader
29 changes: 29 additions & 0 deletions src/fileshare/azext_fileshare/_help.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: disable=line-too-long
# pylint: disable=too-many-lines

from knack.help_files import helps # pylint: disable=unused-import

helps['fileshare private-endpoint-connection approve'] = """
type: command
short-summary: Approve a private endpoint connection for a file share.
examples:
- name: Approve a private endpoint connection
text: |
az fileshare private-endpoint-connection approve --name MyConnection --resource-group MyRG --resource-name MyFileShare
"""

helps['fileshare private-endpoint-connection reject'] = """
type: command
short-summary: Reject a private endpoint connection for a file share.
examples:
- name: Reject a private endpoint connection
text: |
az fileshare private-endpoint-connection reject --name MyConnection --resource-group MyRG --resource-name MyFileShare
"""
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-statements

from knack.log import get_logger


logger = get_logger(__name__)
def load_arguments(self, _): # pylint: disable=unused-argument
pass
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"fileshare",
)
class __CMDGroup(AAZCommandGroup):
"""Manage Azure File Shares
"""Manage Azure File Shares.
"""
pass

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
"fileshare check-name-availability",
)
class CheckNameAvailability(AAZCommand):
"""Implements local CheckNameAvailability operations
"""Check if a file share name is available.

:example: Check name availability for a file share
az fileshare check-name-availability --location westus --name myfileshare
az fileshare check-name-availability --location eastus --name MyFileShare
"""

_aaz_info = {
"version": "2025-09-01-preview",
"version": "2026-06-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/providers/microsoft.fileshares/locations/{}/checknameavailability", "2025-09-01-preview"],
["mgmt-plane", "/subscriptions/{}/providers/microsoft.fileshares/locations/{}/checknameavailability", "2026-06-01"],
]
}

Expand Down Expand Up @@ -56,14 +56,12 @@ def _build_arguments_schema(cls, *args, **kwargs):
options=["--name"],
arg_group="Body",
help="The name of the resource for which availability needs to be checked.",
required=True,
)
_args_schema.type = AAZStrArg(
options=["--type"],
arg_group="Body",
help="The resource type.",
)
_args_schema.type._registered = False
return cls._args_schema

def _execute_operations(self):
Expand All @@ -73,7 +71,7 @@ def _execute_operations(self):

@register_callback
def pre_operations(self):
self.ctx.args.type = "Microsoft.FileShares/fileShares"
pass

@register_callback
def post_operations(self):
Expand Down Expand Up @@ -127,7 +125,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2025-09-01-preview",
"api-version", "2026-06-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ class Create(AAZCommand):
"""Create a file share.

:example: Create a file share with NFS protocol
az fileshare create --name MyFileShare --resource-group MyRG --location eastus --provisioned-storage-GiB 1024 --provisioned-iops 3000 --provisioned-throughput-MiB 125 --protocol NFS --redundancy Local
az fileshare create --name MyFileShare --resource-group MyRG --location eastus --provisioned-storage-gib 1024 --provisioned-iops 3000 --provisioned-throughput-mib 125 --protocol NFS --redundancy Local

:example: Create a file share with root squash and subnet access
az fileshare create --name MyFileShare --resource-group MyRG --location eastus --provisioned-storage-gib 1024 --provisioned-iops 3000 --provisioned-throughput-mib 125 --protocol NFS --redundancy Local --root-squash RootSquash --public-network-access Enabled --allowed-subnets /subscriptions/sub-id/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet/subnets/subnet1
"""

_aaz_info = {
"version": "2025-09-01-preview",
"version": "2026-06-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}", "2025-09-01-preview"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}", "2026-06-01"],
]
}

Expand Down Expand Up @@ -57,6 +60,22 @@ def _build_arguments_schema(cls, *args, **kwargs):
),
)

# define Arg Group "NfsProtocolProperties"

_args_schema = cls._args_schema
_args_schema.encryption_in_transit_required = AAZStrArg(
options=["--encryption-in-transit", "--encryption-in-transit-required"],
arg_group="NfsProtocolProperties",
help="Encryption in transit defines whether data is encrypted for NFS shares.",
enum={"Disabled": "Disabled", "Enabled": "Enabled"},
)
_args_schema.root_squash = AAZStrArg(
options=["--root-squash"],
arg_group="NfsProtocolProperties",
help="Root squash defines how root users on clients are mapped to the NFS share.",
enum={"AllSquash": "AllSquash", "NoRootSquash": "NoRootSquash", "RootSquash": "RootSquash"},
)

# define Arg Group "Properties"

_args_schema = cls._args_schema
Expand All @@ -71,12 +90,6 @@ def _build_arguments_schema(cls, *args, **kwargs):
arg_group="Properties",
help="The name of the file share as seen by the end user when mounting the share, such as in a URI or UNC format in their operating system.",
)
_args_schema.nfs_protocol_properties = AAZObjectArg(
options=["--nfs-props", "--nfs-protocol-properties"],
arg_group="Properties",
help="Protocol settings specific NFS.",
)
_args_schema.nfs_protocol_properties._registered = False
_args_schema.protocol = AAZStrArg(
options=["--protocol"],
arg_group="Properties",
Expand All @@ -89,21 +102,15 @@ def _build_arguments_schema(cls, *args, **kwargs):
help="The provisioned IO / sec of the share.",
)
_args_schema.provisioned_storage_gi_b = AAZIntArg(
options=["--provisioned-storage-GiB", "--storage-gib", "--provisioned-storage-gi-b"],
options=["--storage-gib", "--provisioned-storage-gib", "--provisioned-storage-gi-b"],
arg_group="Properties",
help="The provisioned storage size of the share in GiB (1 GiB is 1024^3 bytes or 1073741824 bytes). A component of the file share's bill is the provisioned storage, regardless of the amount of used storage.",
)
_args_schema.provisioned_throughput_mi_b_per_sec = AAZIntArg(
options=["--provisioned-throughput-MiB", "--throughput-mibps", "--provisioned-throughput-mi-b-per-sec"],
options=["--throughput-mibps", "--provisioned-throughput-mib", "--provisioned-throughput-mi-b-per-sec"],
arg_group="Properties",
help="The provisioned throughput / sec of the share.",
)
_args_schema.public_access_properties = AAZObjectArg(
options=["--public-access", "--public-access-properties"],
arg_group="Properties",
help="The set of properties for control public access.",
)
_args_schema.public_access_properties._registered = False
_args_schema.public_network_access = AAZStrArg(
options=["--public-network-access"],
arg_group="Properties",
Expand All @@ -117,36 +124,17 @@ def _build_arguments_schema(cls, *args, **kwargs):
enum={"Local": "Local", "Zone": "Zone"},
)

nfs_protocol_properties = cls._args_schema.nfs_protocol_properties
nfs_protocol_properties.root_squash = AAZStrArg(
options=["root-squash"],
help="Root squash defines how root users on clients are mapped to the NFS share.",
enum={"AllSquash": "AllSquash", "NoRootSquash": "NoRootSquash", "RootSquash": "RootSquash"},
)
# define Arg Group "PublicAccessProperties"

public_access_properties = cls._args_schema.public_access_properties
public_access_properties.allowed_subnets = AAZListArg(
options=["allowed-subnets"],
help="The allowed set of subnets when access is restricted.",
)

allowed_subnets = cls._args_schema.public_access_properties.allowed_subnets
allowed_subnets.Element = AAZStrArg()

# define flat args for NFS and public access
_args_schema = cls._args_schema
_args_schema.root_squash = AAZStrArg(
options=["--root-squash"],
arg_group="Properties",
help="Root squash defines how root users on clients are mapped to the NFS share.",
enum={"AllSquash": "AllSquash", "NoRootSquash": "NoRootSquash", "RootSquash": "RootSquash"},
)
_args_schema.allowed_subnets = AAZListArg(
options=["--allowed-subnets"],
arg_group="Properties",
help="Space-separated list of subnet resource IDs that are allowed access.",
arg_group="PublicAccessProperties",
help="The allowed set of subnets when access is restricted.",
)
_args_schema.allowed_subnets.Element = AAZStrArg()

allowed_subnets = cls._args_schema.allowed_subnets
allowed_subnets.Element = AAZStrArg()

# define Arg Group "Resource"

Expand Down Expand Up @@ -176,11 +164,7 @@ def _execute_operations(self):

@register_callback
def pre_operations(self):
args = self.ctx.args
if has_value(args.root_squash):
args.nfs_protocol_properties = {"root_squash": args.root_squash}
if has_value(args.allowed_subnets):
args.public_access_properties = {"allowed_subnets": args.allowed_subnets}
pass

@register_callback
def post_operations(self):
Expand Down Expand Up @@ -254,7 +238,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2025-09-01-preview",
"api-version", "2026-06-01",
required=True,
),
}
Expand Down Expand Up @@ -287,17 +271,18 @@ def content(self):
if properties is not None:
properties.set_prop("mediaTier", AAZStrType, ".media_tier")
properties.set_prop("mountName", AAZStrType, ".mount_name")
properties.set_prop("nfsProtocolProperties", AAZObjectType, ".nfs_protocol_properties")
properties.set_prop("nfsProtocolProperties", AAZObjectType)
properties.set_prop("protocol", AAZStrType, ".protocol")
properties.set_prop("provisionedIOPerSec", AAZIntType, ".provisioned_io_per_sec")
properties.set_prop("provisionedStorageGiB", AAZIntType, ".provisioned_storage_gi_b")
properties.set_prop("provisionedThroughputMiBPerSec", AAZIntType, ".provisioned_throughput_mi_b_per_sec")
properties.set_prop("publicAccessProperties", AAZObjectType, ".public_access_properties")
properties.set_prop("publicAccessProperties", AAZObjectType)
properties.set_prop("publicNetworkAccess", AAZStrType, ".public_network_access")
properties.set_prop("redundancy", AAZStrType, ".redundancy")

nfs_protocol_properties = _builder.get(".properties.nfsProtocolProperties")
if nfs_protocol_properties is not None:
nfs_protocol_properties.set_prop("encryptionInTransitRequired", AAZStrType, ".encryption_in_transit_required")
nfs_protocol_properties.set_prop("rootSquash", AAZStrType, ".root_squash")

public_access_properties = _builder.get(".properties.publicAccessProperties")
Expand Down Expand Up @@ -413,6 +398,9 @@ def _build_schema_on_200_201(cls):
properties.redundancy = AAZStrType()

nfs_protocol_properties = cls._schema_on_200_201.properties.nfs_protocol_properties
nfs_protocol_properties.encryption_in_transit_required = AAZStrType(
serialized_name="encryptionInTransitRequired",
)
nfs_protocol_properties.root_squash = AAZStrType(
serialized_name="rootSquash",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
confirmation="Are you sure you want to perform this operation?",
)
class Delete(AAZCommand):
"""Delete a FileShare
"""Delete a file share

:example: Delete a fileshare
az fileshare delete --resource-group MyRG --name MyFileShare
"""

_aaz_info = {
"version": "2025-09-01-preview",
"version": "2026-06-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}", "2025-09-01-preview"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.fileshares/fileshares/{}", "2026-06-01"],
]
}

Expand Down Expand Up @@ -143,7 +146,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2025-09-01-preview",
"api-version", "2026-06-01",
required=True,
),
}
Expand Down
Loading
Loading