Skip to content

Create Az.CloudHsm Module for 2025-03-31 #27947

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

Merged
merged 23 commits into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
06b58a3
Initial commit Az.CloudHsm 2025-03-31
emmeliaAra Jun 12, 2025
2fde28a
Update module - feedback
emmeliaAra Jun 13, 2025
073193d
Remove tests for the cmdlets that are removed or hidden.
emmeliaAra Jun 13, 2025
f65fb95
Resolve conflict
emmeliaAra Jun 13, 2025
55e804d
Remove empty space
emmeliaAra Jun 16, 2025
490eac2
Reset NuGet Config from Main
emmeliaAra Jun 16, 2025
041133f
merge with main
emmeliaAra Jun 16, 2025
12b0246
Merge branch 'cloudHsm-2025-03-31-v' of https://github.com/emmeliaAra…
emmeliaAra Jun 16, 2025
0332a3f
Update input-file to remote swagger file
emmeliaAra Jun 23, 2025
74f6263
Fix error: BlockIdentifiersNotMatched (5064) - The start and end id…
emmeliaAra Jun 23, 2025
86aba7e
Merge branch 'cloudHsm-2025-03-31-v' of https://github.com/emmeliaAra…
emmeliaAra Jun 23, 2025
b064514
update restore test
emmeliaAra Jun 23, 2025
d64f5c7
Merge branch 'cloudHsm-2025-03-31-v' of https://github.com/emmeliaAra…
emmeliaAra Jun 23, 2025
3bb1042
Fix batch generation build artifact (#27945)
Pan-Qi Jun 24, 2025
25119a9
Update Readme and example files based on feedback
emmeliaAra Jun 24, 2025
00dc503
Merge branch 'cloudHsm-2025-03-31-v' of https://github.com/emmeliaAra…
emmeliaAra Jun 24, 2025
e1b3c8c
update test and examples
emmeliaAra Jun 24, 2025
68d24c9
resolve conflicts with main
emmeliaAra Jun 24, 2025
05ef39e
Updated managed identity remove example + docs/help md for other comm…
emmeliaAra Jun 24, 2025
150f494
Merge branch 'cloudHsm-2025-03-31-v' of https://github.com/emmeliaAra…
emmeliaAra Jun 24, 2025
659d76d
Revert "Fix batch generation build artifact (#27945)"
emmeliaAra Jun 24, 2025
5f57780
fix typo - duplicate commands
emmeliaAra Jun 24, 2025
e45cb71
update
emmeliaAra Jun 24, 2025
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
1 change: 1 addition & 0 deletions src/CloudHsm/CloudHsm.Autorest/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
16 changes: 16 additions & 0 deletions src/CloudHsm/CloudHsm.Autorest/.gitignore
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
26 changes: 26 additions & 0 deletions src/CloudHsm/CloudHsm.Autorest/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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 - CloudHsm")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("0.1.0")]
[assembly: System.Reflection.AssemblyVersionAttribute("0.1.0")]
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.CLSCompliantAttribute(false)]
189 changes: 189 additions & 0 deletions src/CloudHsm/CloudHsm.Autorest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
<!-- region Generated -->
# Az.CloudHsm
This directory contains the PowerShell module for the CloudHsm 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.CloudHsm`, see [how-to.md](how-to.md).
<!-- endregion -->

### AutoRest Configuration

> see https://aka.ms/autorest

```yaml
# pin the swagger version by using the commit id instead of branch name
commit: 55cb134eeb9f92c8df1f6437a9e1130c4c2c4cc5
require:
# readme.azure.noprofile.md is the common configuration file
- $(this-folder)/../../readme.azure.noprofile.md
#- $(repo)/specification/xxx/resource-manager/readme.md
# If the swagger has not been put in the repo, you may uncomment the following line and refer to it locally
# - (this-folder)/relative-path-to-your-local-readme.md

input-file:
- $(repo)/specification/hardwaresecuritymodules/resource-manager/Microsoft.HardwareSecurityModules/stable/2025-03-31/cloudhsm.json
try-require:
- $(repo)/specification/hardwaresecuritymodules/resource-manager/readme.powershell.md

# For new RP, the version is 0.1.0
module-version: 0.1.0
# Normally, title is the service name
title: CloudHsm

# The next three configurations are exclusive to v3, and in v4, they are activated by default. If you are still using v3, please uncomment them.
# identity-correction-for-post: true
# resourcegroup-append: true
# nested-object-to-string: true

directive:
# Following are common directives which are normally required in all the RPs
# 1. Remove the unexpanded parameter set
# 2. For New-* cmdlets, ViaIdentity is not required
# Following two directives are v4 specific
- where:
variant: ^(Create|Update)(?!.*?(Expanded))
remove: true
- where:
variant: ^CreateViaIdentity$|^CreateViaIdentityExpanded$|^UpdateViaIdentityExpanded$|^CreateViaJsonString$|^CreateViaJsonFilePath$
remove: true
# Follow directive is v3 specific. If you are using v3, uncomment following directive and comments out two directives above
#- where:
# variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
# remove: true

#Remove ViaIdentity, ViaIdentityExpaned, JsonString and JsonFilePath commands
- where:
variant: ^(Backup|BackupViaIdentityExpanded|Restore|RestoreViaIdentityExpanded|GetViaIdentity|DeleteViaIdentity)(?!.*?(Expanded))
remove: true

# Remove the set-* cmdlet
- where:
verb: Set
remove: true

# Remove the Private Endpoint cmdlet that are autogenerated
- where:
subject: PrivateEndpointConnection|PrivateLinkResource
remove: true

# Remove the Private Endpoint cmdlet that are autogenerated
- where:
verb: Test
remove: true

# Remove SkuCapacity, EnableSystemAssignedIdentity, PublicNetworkAccess and Token parameters from all commansd
- where:
parameter-name: SkuCapacity|EnableSystemAssignedIdentity|PublicNetworkAccess|Token
hide: true

# Rename CloudHsmClusterName parameter to Name.
- where:
parameter-name: CloudHsmClusterName
set:
parameter-name: Name

# Both commands have property EnableSystemAssignedIdentity as mandatory because in Swaggger spec we specify ManagedIdentity which by default has Both User and System Assign Identity Enums.
# Our service only allows UserAssign Identity and to remove the extra property EnableSystemAssignedIdentity we need to:
# 1. Hide New and Update commands.
# 2. Get the internal version of the commands from CloudHsm.Autorest/internal/
# 3. Copy the files to CloudHsm.Autorest/internal
# 4. Remove the extra property and build

- where:
verb: ^New$|^Update$|^Get$|^Backup$|^Restore$|^Get$|^Remove$
hide: true

# Make SKU parameter required for New-AzCloudHsm command
- where:
verb: ^New$
parameter-name: SkuName
required: true
set:
parameter-name: Sku
default:
script: '"Standard_B1"'

# Rename Backup, Restore, New, Update and Remove commands to remove 'Cluster' prefix from the command name. ex: New-AzCloudHsmCluster to New-AzCloudHsm
- where:
verb: ^Backup$|^Restore$|^New$|^Update$|^Remove$
subject: ''
set:
subject-prefix: ''
subject: CloudHsm

# Rename Backup, Restore, New, Update and Remove commands to remove 'Cluster' prefix from the command name. ex: New-AzCloudHsmCluster to New-AzCloudHsm
- where:
verb: ^Backup$|^Restore$
parameter-name: Name
set:
parameter-name: ClusterName

# Rename name property of Backup, Restore commands
- where:
verb: ^Backup$|^Restore$
subject: ''
parameter-name: Name
set:
parameter-name: SkuName

# Rename property in backup and restore commands
- where:
verb: ^Backup$|^Restore$
subject: ''
parameter-name: AzureStorageBlobContainerUri
set:
parameter-name: BlobContainerUri

# Rename Get-CloudHsmClusterBackupStatus commands to Get-CloudHsmBackupStatus
- where:
verb: ^Get$
subject: CloudHsmClusterBackupStatus
remove: true

# Rename Get-CloudHsmClusterRestoreStatus commands to Get-CloudHsmRestoreStatus
- where:
verb: ^Get$
subject: CloudHsmClusterRestoreStatus
remove: true

# Rename Get-CloudHsmCluster commands to Get-CloudHsm
- where:
verb: ^Get$
subject: CloudHsmCluster
set:
subject-prefix: ''
subject: CloudHsm

- where:
parameter-name: SkuName
set:
parameter-name: Sku

- where:
verb: Update
parameter-name: AutoGeneratedDomainNameLabelScope
hide: true

- where:
parameter-name: AutoGeneratedDomainNameLabelScope
set:
parameter-name: DomainNameLabelScope

```
17 changes: 17 additions & 0 deletions src/CloudHsm/CloudHsm.Autorest/custom/Az.CloudHsm.custom.psm1
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.CloudHsm.private.dll')

# Load the internal module
$internalModulePath = Join-Path $PSScriptRoot '..\internal\Az.CloudHsm.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
Loading