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
1 change: 1 addition & 0 deletions src/GuestConfiguration/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
16 changes: 16 additions & 0 deletions src/GuestConfiguration/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
bin
obj
.vs
generated
internal
exports
tools
custom/*.psm1
custom/autogen-model-cmdlets
test/*-TestResults.xml
/*.ps1
/*.ps1xml
/*.psm1
/*.snk
/*.csproj
/*.nuspec
24 changes: 24 additions & 0 deletions src/GuestConfiguration/Az.GuestConfiguration.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@{
GUID = 'f2042330-dd50-496f-aac0-69f27fd54f2a'
RootModule = './Az.GuestConfiguration.psm1'
ModuleVersion = '0.10.8'
CompatiblePSEditions = 'Core', 'Desktop'
Author = 'Microsoft Corporation'
CompanyName = 'Microsoft Corporation'
Copyright = 'Microsoft Corporation. All rights reserved.'
Description = 'Microsoft Azure PowerShell: GuestConfiguration cmdlets'
PowerShellVersion = '5.1'
DotNetFrameworkVersion = '4.7.2'
RequiredAssemblies = './bin/Az.GuestConfiguration.private.dll'
FormatsToProcess = './Az.GuestConfiguration.format.ps1xml'
FunctionsToExport = 'Get-AzGuestConfigurationAssignment', 'Get-AzGuestConfigurationAssignmentReport', 'New-AzGuestConfigurationAssignment', 'Remove-AzGuestConfigurationAssignment', '*'
AliasesToExport = '*'
PrivateData = @{
PSData = @{
Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'GuestConfiguration'
LicenseUri = 'https://aka.ms/azps-license'
ProjectUri = 'https://github.com/Azure/azure-powershell'
ReleaseNotes = ''
}
}
}
109 changes: 109 additions & 0 deletions src/GuestConfiguration/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<!-- region Generated -->
# Az.GuestConfiguration
This directory contains the PowerShell module for the GuestConfiguration service.

---
## Status
[![Az.GuestConfiguration](https://img.shields.io/powershellgallery/v/Az.GuestConfiguration.svg?style=flat-square&label=Az.GuestConfiguration "Az.GuestConfiguration")](https://www.powershellgallery.com/packages/Az.GuestConfiguration/)

## 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.GuestConfiguration`, see [how-to.md](how-to.md).
<!-- endregion -->

### AutoRest Configuration
> see https://aka.ms/autorest
``` yaml
branch: d5c524d7228920ac75e27efe2e4616d5e43f71b1
require:
- $(this-folder)/../readme.azure.noprofile.md
# lock the commit
input-file:
- $(repo)/specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/guestconfiguration.json
module-version: 0.10.8
title: GuestConfiguration
subject-prefix: $(service-name)
identity-correction-for-post: true
nested-object-to-string: true
resourcegroup-append: true
directive:
# Following is two common directive which are normally required in all the RPs
# 1. Remove the unexpanded parameter set
# 2. For New-* cmdlets, ViaIdentity is not required, so CreateViaIdentityExpanded is removed as well
- where:
variant: ^Create$|^Create1$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$
remove: true
# Remove the set-* cmdlet
- where:
verb: Set
remove: true
# GuestConfigurationAssignmentsVMSS_{Action} -> GuestConfigurationAssignments_{Action}ByVMSS
- from: swagger-document
where: $.paths..operationId
transform: return $.replace(/^(GuestConfiguration)(.+)VMSS(_.+)/g, "$1$2$3ByVMSS")
# GuestConfigurationHCRPAssignments_{Action} -> GuestConfigurationAssignments_{Action}ByHCRP
# GuestConfigurationHCRPAssignmentReports_List -> GuestConfigurationAssignmentReports_ListByHCRP
- from: swagger-document
where: $.paths..operationId
transform: return $.replace(/^(GuestConfiguration)HCRP(.+)(_.+)/g, "$1$2$3ByHCRP")
# GuestConfigurationAssignments_RGList -> GuestConfigurationAssignments_ListByRg
# GuestConfigurationAssignments_SubscriptionList -> GuestConfigurationAssignments_ListBySubscription
- from: swagger-document
where: $.paths..operationId
transform: return $.replace(/^(GuestConfigurationAssignments_)(.+)(List)$/, "$1$3By$2")
# Remove all get/create/delete ViaIdentity operations
- where:
variant: ^GetViaIdentity.*|^CreateViaIdentity.*|^DeleteViaIdentity.*
remove: true
# Hide Remove-AzGuestConfigurationAssignment to customize InputObject case
- where:
verb: Remove
subject: GuestConfigurationAssignment
hide: true
# The properties of VmssVMList are read-only
- where:
parameter-name: VmssVMList
hide: true
# The properties of AssignmentReportResource are read-only
- where:
parameter-name: LatestAssignmentReportResource
hide: true
# Change GuestConfigurationNavigation to required
- from: swagger-document
where: $.definitions.GuestConfigurationAssignment
transform: $["required"] = ["properties"]
# Change GuestConfigurationNavigation to required
- from: swagger-document
where: $.definitions.GuestConfigurationAssignmentProperties
transform: $["required"] = ["guestConfiguration"]
# Change GuestConfigurationNavigation.name,
# GuestConfigurationNavigation.version
# GuestConfigurationNavigation.contentUri
# and GuestConfigurationNavigation.contentHash to required
- from: swagger-document
where: $.definitions.GuestConfigurationNavigation
transform: $["required"] = ["name", "version", "contentUri", "contentHash"]
# Change reports/{id} -> reports/{reportId} to avoid conflicts when piping an assignment
- from: swagger-document
where: $
transform: $ = $.replace(/reports\/{id}/g, "reports/{reportId}")
- from: swagger-document
where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}/reports/{reportId}"].get.parameters[4]
transform: >-
$.name = "reportId"
```
41 changes: 41 additions & 0 deletions src/GuestConfiguration/custom/README.md
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.GuestConfiguration` 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.GuestConfiguration.custom.psm1`. This file should not be modified.

## Info
- Modifiable: yes
- Generated: partial
- Committed: yes
- Packaged: yes

## Details
For `Az.GuestConfiguration` 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.GuestConfiguration.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.GuestConfiguration.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.GuestConfiguration`. 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.GuestConfiguration.DescriptionAttribute`
- Used in C# cmdlets to provide a high-level description of the cmdlet. This is propagated to reference documentation via [help comments](https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts.
- `Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.DoNotExportAttribute`
- Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.GuestConfiguration`.
- `Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.InternalExportAttribute`
- Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.GuestConfiguration`. For more information, see [README.md](..\internal/README.md) in the `..\internal` folder.
- `Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.ProfileAttribute`
- Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules.
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@

# ----------------------------------------------------------------------------------
# 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.
# ----------------------------------------------------------------------------------

<#
.Synopsis
Delete a guest configuration assignment
.Description
Delete a guest configuration assignment
.Example
Remove-AzGuestConfigurationAssignment -ResourceGroupName test-rg -VMName test-vm -Name test-assignment -PassThru
.Example
Get-AzGuestConfigurationAssignment -ResourceGroupName test-rg -VMName test-vm -Name test-assignment | Remove-AzGuestConfigurationAssignment -PassThru

.Inputs
Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.IGuestConfigurationIdentity
.Outputs
Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.Api20220125.IGuestConfigurationAssignment
.Outputs
System.Boolean
.Notes
COMPLEX PARAMETER PROPERTIES

To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.

INPUTOBJECT <IGuestConfigurationIdentity>: Identity Parameter
[GuestConfigurationAssignmentName <String>]: Name of the guest configuration assignment.
[Id <String>]: Resource identity path
[MachineName <String>]: The name of the ARC machine.
[Name <String>]: The guest configuration assignment name.
[ReportId <String>]: The GUID for the guest configuration assignment report.
[ResourceGroupName <String>]: The resource group name.
[SubscriptionId <String>]: Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
[VMName <String>]: The name of the virtual machine.
[VmssName <String>]: The name of the virtual machine scale set.
.Link
https://docs.microsoft.com/powershell/module/az.guestconfiguration/remove-azguestconfigurationassignment
#>
function Remove-AzGuestConfigurationAssignment {
[OutputType([System.Boolean], [Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.Api20220125.IGuestConfigurationAssignment])]
[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')]
param(
[Parameter(ParameterSetName='Delete', Mandatory)]
[Parameter(ParameterSetName='Delete1', Mandatory)]
[Parameter(ParameterSetName='Delete2', Mandatory)]
[Alias('GuestConfigurationAssignmentName')]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Category('Path')]
[System.String]
# Name of the guest configuration assignment
${Name},

[Parameter(ParameterSetName='Delete', Mandatory)]
[Parameter(ParameterSetName='Delete1', Mandatory)]
[Parameter(ParameterSetName='Delete2', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Category('Path')]
[System.String]
# The resource group name.
${ResourceGroupName},

[Parameter(ParameterSetName='Delete')]
[Parameter(ParameterSetName='Delete1')]
[Parameter(ParameterSetName='Delete2')]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')]
[System.String]
# Subscription ID which uniquely identify Microsoft Azure subscription.
# The subscription ID forms part of the URI for every service call.
${SubscriptionId},

[Parameter(ParameterSetName='Delete', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Category('Path')]
[System.String]
# The name of the virtual machine.
${VMName},

[Parameter(ParameterSetName='Delete1', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Category('Path')]
[System.String]
# The name of the ARC machine.
${MachineName},

[Parameter(ParameterSetName='Delete2', Mandatory)]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Category('Path')]
[System.String]
# The name of the virtual machine scale set.
${VmssName},

[Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Category('Path')]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Models.IGuestConfigurationIdentity]
# Identity Parameter
# To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
${InputObject},

[Parameter()]
[Alias('AzureRMContext', 'AzureCredential')]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Category('Azure')]
[System.Management.Automation.PSObject]
# The credentials, account, tenant, and subscription used for communication with Azure.
${DefaultProfile},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Wait for .NET debugger to attach
${Break},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be appended to the front of the pipeline
${HttpPipelineAppend},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Category('Runtime')]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Runtime.SendAsyncStep[]]
# SendAsync Pipeline Steps to be prepended to the front of the pipeline
${HttpPipelinePrepend},

[Parameter()]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Returns true when the command succeeds
${PassThru},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Category('Runtime')]
[System.Uri]
# The URI for the proxy server to use
${Proxy},

[Parameter(DontShow)]
[ValidateNotNull()]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Category('Runtime')]
[System.Management.Automation.PSCredential]
# Credentials for a proxy server to use for the remote call
${ProxyCredential},

[Parameter(DontShow)]
[Microsoft.Azure.PowerShell.Cmdlets.GuestConfiguration.Category('Runtime')]
[System.Management.Automation.SwitchParameter]
# Use the default credentials for the proxy
${ProxyUseDefaultCredentials}
)
process {
$PSBoundParameters = TransformPSBoundParameters -PSBoundParameters $PSBoundParameters
Az.GuestConfiguration.internal\Remove-AzGuestConfigurationAssignment @PSBoundParameters

}
}
Loading