-
Notifications
You must be signed in to change notification settings - Fork 4.1k
[FileShare] Add Az.FileShare module first preview release #29208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
blueww
wants to merge
4
commits into
Azure:main
Choose a base branch
from
wastoresh:MFS-new2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * text=auto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| bin | ||
| obj | ||
| .vs | ||
| generated | ||
| internal | ||
| exports | ||
| tools | ||
| test/*-TestResults.xml | ||
| license.txt | ||
| /*.ps1 | ||
| /*.psd1 | ||
| /*.ps1xml | ||
| /*.psm1 | ||
| /*.snk | ||
| /*.csproj | ||
| /*.nuspec |
30 changes: 30 additions & 0 deletions
30
src/FileShare/FileShare.Autorest/Properties/AssemblyInfo.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
| // Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the Apache License, Version 2.0 (the ""License""); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an ""AS IS"" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code | ||
| // is regenerated. | ||
|
|
||
| using System; | ||
| using System.Reflection; | ||
| using System.Runtime.CompilerServices; | ||
| using System.Runtime.InteropServices; | ||
|
|
||
| [assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft")] | ||
| [assembly: System.Reflection.AssemblyCopyrightAttribute("Copyright © Microsoft")] | ||
| [assembly: System.Reflection.AssemblyProductAttribute("Microsoft Azure PowerShell")] | ||
| [assembly: System.Reflection.AssemblyTitleAttribute("Microsoft Azure PowerShell - MicrosoftFileShares")] | ||
| [assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.0")] | ||
| [assembly: System.Reflection.AssemblyVersionAttribute("0.1.0")] | ||
| [assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)] | ||
| [assembly: System.CLSCompliantAttribute(false)] | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| <!-- region Generated --> | ||
| # Az.FileShare | ||
| This directory contains the PowerShell module for the FileShare service. | ||
|
|
||
| --- | ||
| ## Info | ||
| - Modifiable: yes | ||
| - Generated: all | ||
| - Committed: yes | ||
| - Packaged: yes | ||
|
|
||
| --- | ||
| ## Detail | ||
| This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension. | ||
|
|
||
| ## Module Requirements | ||
| - [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 2.7.5 or greater | ||
|
|
||
| ## Authentication | ||
| AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent. | ||
|
|
||
| ## Development | ||
| For information on how to develop for `Az.FileShare`, see [how-to.md](how-to.md). | ||
| <!-- endregion --> | ||
95 changes: 95 additions & 0 deletions
95
src/FileShare/FileShare.Autorest/UX/Microsoft.FileShares/fileShares-fileShareSnapshots.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| { | ||
| "resourceType": "fileShares/fileShareSnapshots", | ||
| "apiVersion": "2025-09-01-preview", | ||
| "learnMore": { | ||
| "url": "https://learn.microsoft.com/powershell/module/az.fileshare" | ||
| }, | ||
| "commands": [ | ||
| { | ||
| "name": "Get-AzFileShareSnapshot", | ||
| "description": "Get a FileShareSnapshot", | ||
| "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name}", | ||
| "help": { | ||
| "learnMore": { | ||
| "url": "https://learn.microsoft.com/powershell/module/az.fileshare/get-azfilesharesnapshot" | ||
| }, | ||
| "parameterSets": [ | ||
| { | ||
| "parameters": [ | ||
| "-Name <String>", | ||
| "-ResourceGroupName <String>", | ||
| "-ResourceName <String>", | ||
| "[-SubscriptionId <String[]>]" | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| "examples": [ | ||
| { | ||
| "description": "Get a FileShareSnapshot", | ||
| "parameters": [ | ||
| { | ||
| "name": "-Name", | ||
| "value": "[Path.name]" | ||
| }, | ||
| { | ||
| "name": "-ResourceGroupName", | ||
| "value": "[Path.resourceGroupName]" | ||
| }, | ||
| { | ||
| "name": "-ResourceName", | ||
| "value": "[Path.resourceName]" | ||
| }, | ||
| { | ||
| "name": "-SubscriptionId", | ||
| "value": "[Path.subscriptionId]" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "Remove-AzFileShareSnapshot", | ||
| "description": "Delete a FileShareSnapshot.", | ||
| "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}/fileShareSnapshots/{name}", | ||
| "help": { | ||
| "learnMore": { | ||
| "url": "https://learn.microsoft.com/powershell/module/az.fileshare/remove-azfilesharesnapshot" | ||
| }, | ||
| "parameterSets": [ | ||
| { | ||
| "parameters": [ | ||
| "-Name <String>", | ||
| "-ResourceGroupName <String>", | ||
| "-ResourceName <String>", | ||
| "[-SubscriptionId <String>]" | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| "examples": [ | ||
| { | ||
| "description": "Delete a FileShareSnapshot.", | ||
| "parameters": [ | ||
| { | ||
| "name": "-Name", | ||
| "value": "[Path.name]" | ||
| }, | ||
| { | ||
| "name": "-ResourceGroupName", | ||
| "value": "[Path.resourceGroupName]" | ||
| }, | ||
| { | ||
| "name": "-ResourceName", | ||
| "value": "[Path.resourceName]" | ||
| }, | ||
| { | ||
| "name": "-SubscriptionId", | ||
| "value": "[Path.subscriptionId]" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
85 changes: 85 additions & 0 deletions
85
src/FileShare/FileShare.Autorest/UX/Microsoft.FileShares/fileShares.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| { | ||
| "resourceType": "fileShares", | ||
| "apiVersion": "2025-09-01-preview", | ||
| "learnMore": { | ||
| "url": "https://learn.microsoft.com/powershell/module/az.fileshare" | ||
| }, | ||
| "commands": [ | ||
| { | ||
| "name": "Get-AzFileShare", | ||
| "description": "Get a FileShare", | ||
| "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}", | ||
| "help": { | ||
| "learnMore": { | ||
| "url": "https://learn.microsoft.com/powershell/module/az.fileshare/get-azfileshare" | ||
| }, | ||
| "parameterSets": [ | ||
| { | ||
| "parameters": [ | ||
| "-ResourceGroupName <String>", | ||
| "-ResourceName <String>", | ||
| "[-SubscriptionId <String[]>]" | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| "examples": [ | ||
| { | ||
| "description": "Get a FileShare", | ||
| "parameters": [ | ||
| { | ||
| "name": "-ResourceGroupName", | ||
| "value": "[Path.resourceGroupName]" | ||
| }, | ||
| { | ||
| "name": "-ResourceName", | ||
| "value": "[Path.resourceName]" | ||
| }, | ||
| { | ||
| "name": "-SubscriptionId", | ||
| "value": "[Path.subscriptionId]" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "Remove-AzFileShare", | ||
| "description": "Delete a FileShare", | ||
| "path": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.FileShares/fileShares/{resourceName}", | ||
| "help": { | ||
| "learnMore": { | ||
| "url": "https://learn.microsoft.com/powershell/module/az.fileshare/remove-azfileshare" | ||
| }, | ||
| "parameterSets": [ | ||
| { | ||
| "parameters": [ | ||
| "-ResourceGroupName <String>", | ||
| "-ResourceName <String>", | ||
| "[-SubscriptionId <String>]" | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| "examples": [ | ||
| { | ||
| "description": "Delete a FileShare", | ||
| "parameters": [ | ||
| { | ||
| "name": "-ResourceGroupName", | ||
| "value": "[Path.resourceGroupName]" | ||
| }, | ||
| { | ||
| "name": "-ResourceName", | ||
| "value": "[Path.resourceName]" | ||
| }, | ||
| { | ||
| "name": "-SubscriptionId", | ||
| "value": "[Path.subscriptionId]" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
75 changes: 75 additions & 0 deletions
75
src/FileShare/FileShare.Autorest/UX/Microsoft.FileShares/locations.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| { | ||
| "resourceType": "locations", | ||
| "apiVersion": "2025-09-01-preview", | ||
| "learnMore": { | ||
| "url": "https://learn.microsoft.com/powershell/module/az.fileshare" | ||
| }, | ||
| "commands": [ | ||
| { | ||
| "name": "Get-AzFileShareLimit", | ||
| "description": "Get file shares limits.", | ||
| "path": "/subscriptions/{subscriptionId}/providers/Microsoft.FileShares/locations/{location}/getLimits", | ||
| "help": { | ||
| "learnMore": { | ||
| "url": "https://learn.microsoft.com/powershell/module/az.fileshare/get-azfilesharelimit" | ||
| }, | ||
| "parameterSets": [ | ||
| { | ||
| "parameters": [ | ||
| "-Location <String>", | ||
| "[-SubscriptionId <String[]>]" | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| "examples": [ | ||
| { | ||
| "description": "Get file shares limits.", | ||
| "parameters": [ | ||
| { | ||
| "name": "-Location", | ||
| "value": "[Path.location]" | ||
| }, | ||
| { | ||
| "name": "-SubscriptionId", | ||
| "value": "[Path.subscriptionId]" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "Get-AzFileShareUsageData", | ||
| "description": "Get file shares usage data.", | ||
| "path": "/subscriptions/{subscriptionId}/providers/Microsoft.FileShares/locations/{location}/getUsageData", | ||
| "help": { | ||
| "learnMore": { | ||
| "url": "https://learn.microsoft.com/powershell/module/az.fileshare/get-azfileshareusagedata" | ||
| }, | ||
| "parameterSets": [ | ||
| { | ||
| "parameters": [ | ||
| "-Location <String>", | ||
| "[-SubscriptionId <String[]>]" | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| "examples": [ | ||
| { | ||
| "description": "Get file shares usage data.", | ||
| "parameters": [ | ||
| { | ||
| "name": "-Location", | ||
| "value": "[Path.location]" | ||
| }, | ||
| { | ||
| "name": "-SubscriptionId", | ||
| "value": "[Path.subscriptionId]" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
17 changes: 17 additions & 0 deletions
17
src/FileShare/FileShare.Autorest/custom/Az.FileShare.custom.psm1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # region Generated | ||
| # Load the private module dll | ||
| $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.FileShare.private.dll') | ||
|
|
||
| # Load the internal module | ||
| $internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.FileShare.internal.psm1' | ||
| if(Test-Path $internalModulePath) { | ||
| $null = Import-Module -Name $internalModulePath | ||
| } | ||
|
|
||
| # Export nothing to clear implicit exports | ||
| Export-ModuleMember | ||
|
|
||
| # Export script cmdlets | ||
| Get-ChildItem -Path $PSScriptRoot -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } | ||
| Export-ModuleMember -Function (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot) -Alias (Get-ScriptCmdlet -ScriptFolder $PSScriptRoot -AsAlias) | ||
| # endregion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # Custom | ||
| This directory contains custom implementation for non-generated cmdlets for the `Az.FileShare` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.FileShare.custom.psm1`. This file should not be modified. | ||
|
|
||
| ## Info | ||
| - Modifiable: yes | ||
| - Generated: partial | ||
| - Committed: yes | ||
| - Packaged: yes | ||
|
|
||
| ## Details | ||
| For `Az.FileShare` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*. | ||
|
|
||
| For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.FileShare.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder. | ||
|
|
||
| For script cmdlets, these are loaded via the `Az.FileShare.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundamental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build. | ||
|
|
||
| ## Purpose | ||
| This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder. | ||
|
|
||
| ## Usage | ||
| The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters: | ||
| - Break | ||
| - DefaultProfile | ||
| - HttpPipelineAppend | ||
| - HttpPipelinePrepend | ||
| - Proxy | ||
| - ProxyCredential | ||
| - ProxyUseDefaultCredentials | ||
|
|
||
| These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.FileShare`. For C#, follow the usage seen in the `ProcessRecordAsync` method. | ||
|
|
||
| ### Attributes | ||
| For processing the cmdlets, we've created some additional attributes: | ||
| - `Microsoft.Azure.PowerShell.Cmdlets.FileShare.DescriptionAttribute` | ||
| - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts. | ||
| - `Microsoft.Azure.PowerShell.Cmdlets.FileShare.DoNotExportAttribute` | ||
| - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.FileShare`. | ||
| - `Microsoft.Azure.PowerShell.Cmdlets.FileShare.InternalExportAttribute` | ||
| - Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.FileShare`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder. | ||
| - `Microsoft.Azure.PowerShell.Cmdlets.FileShare.ProfileAttribute` | ||
| - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.