-
Notifications
You must be signed in to change notification settings - Fork 31
All Configuration related cmdlet should take parameter name as Name instead of ConfigurationName #137
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
All Configuration related cmdlet should take parameter name as Name instead of ConfigurationName #137
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3e481ff
All Configuration related commandlet should take parameter name as Na…
larisaborodina 443dfbd
Set-AzsContainerRegistryConfiguration should not make ConfigurationNa…
larisaborodina f4a8756
Follow up review comments.
larisaborodina ad21276
Set-AzsContainerRegistryConfiguration should not make ConfigurationNa…
larisaborodina a4d5e07
Set-AzsContainerRegistryConfiguration should not make ConfigurationNa…
larisaborodina 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
215 changes: 215 additions & 0 deletions
215
src/Azs.ContainerRegistry.Admin/custom/Start-AzsContainerRegistrySetup.ps1
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,215 @@ | ||
|
|
||
| # ---------------------------------------------------------------------------------- | ||
| # | ||
| # Copyright Microsoft Corporation | ||
| # 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. | ||
| # ---------------------------------------------------------------------------------- | ||
|
|
||
| <# | ||
| .Synopsis | ||
| Invokes container registry certificate uploading and service deployment. | ||
| .Description | ||
| Invokes container registry certificate uploading and service deployment. | ||
| .Example | ||
| PS C:\> Start-AzsContainerRegistrySetup -Password $password -CertificateInputFile $pfx_cert_path | ConvertTo-Json | ||
|
|
||
| { | ||
| "Id": "/subscriptions/7e41090c-4aa7-40bc-856a-a993f8fbd215/providers/Microsoft.ContainerRegistry.Setup/locations/redmond/setup/value", | ||
| "Name": "redmond/value", | ||
| "StatusUri": "https://containerregistrysetup.ascu.azs:4335/providers/Microsoft.ContainerRegistry.Setup/subscriptions/7e41090c-4aa7-40bc-856a-a993f8fbd215/providers/Microsoft.ContainerRegistry.Setup/locations/redmond/setup?api-version=2019-11-01-preview", | ||
| "Type": "Microsoft.ContainerRegistry.Setup/locations/setup" | ||
| } | ||
| .Example | ||
| PS C:\> Start-AzsContainerRegistrySetup -Password $password -CertificateInputFile $pfx_cert_path | ConvertTo-Json | ||
|
|
||
| Start-AzsContainerRegistrySetup : Container registry deployment is still running. It is not allowed to repeat deployment at this stage. | ||
| At line:1 char:1 | ||
| + Start-AzsContainerRegistrySetup -Password $password -CertificateInputFile ... | ||
| + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| + CategoryInfo : InvalidOperation: ({ SubscriptionI...SetupProperty }:<>f__AnonymousType7`3) [Start-AzsContai...p_StartExpanded], Exception | ||
| + FullyQualifiedErrorId : AcrDeploymentStillRunning,Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Cmdlets.StartAzsContainerRegistrySetup_StartExpanded | ||
|
|
||
| .Inputs | ||
| Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Models.Api20191101Preview.IContainerRegistrySetupProperty | ||
| .Inputs | ||
| Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Models.IContainerRegistryAdminIdentity | ||
| .Outputs | ||
| Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Models.Api20191101Preview.IContainerRegistrySetup | ||
| .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 <IContainerRegistryAdminIdentity>: Identity Parameter | ||
| [CapacityName <String>]: The name of the capacity parameter. | ||
| [ConfigurationName <String>]: The name of the configuration. | ||
| [Id <String>]: Resource identity path | ||
| [Location <String>]: The name of Azure region. | ||
| [QuotaName <String>]: The name of the container registry quota. | ||
| [SubscriptionId <String>]: The ID of the target subscription. | ||
|
|
||
| STARTSETUPREQUEST <IContainerRegistrySetupProperty>: Container registry setup properties. | ||
| [Password <SecureString>]: Ssl certificate password. | ||
| [SslCertBase64 <Byte[]>]: Ssl certificate in base64 format. | ||
| .Link | ||
| https://docs.microsoft.com/en-us/powershell/module/azs.containerregistry.admin/start-azscontainerregistrysetup | ||
| #> | ||
| function Start-AzsContainerRegistrySetup { | ||
| [OutputType([Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Models.Api20191101Preview.IContainerRegistrySetup])] | ||
| [CmdletBinding(DefaultParameterSetName='StartExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] | ||
| param( | ||
| [Parameter(ParameterSetName='Start')] | ||
| [Parameter(ParameterSetName='StartExpanded')] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Category('Path')] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Runtime.DefaultInfo(Script='(Get-AzLocation)[0].Location')] | ||
| [System.String] | ||
| # The name of Azure region. | ||
| ${Location}, | ||
|
|
||
| [Parameter(ParameterSetName='Start')] | ||
| [Parameter(ParameterSetName='StartExpanded')] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Category('Path')] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] | ||
| [System.String] | ||
| # The ID of the target subscription. | ||
| ${SubscriptionId}, | ||
|
|
||
| [Parameter(ParameterSetName='StartViaIdentity', Mandatory, ValueFromPipeline)] | ||
| [Parameter(ParameterSetName='StartViaIdentityExpanded', Mandatory, ValueFromPipeline)] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Category('Path')] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Models.IContainerRegistryAdminIdentity] | ||
| # Identity Parameter | ||
| # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. | ||
| ${InputObject}, | ||
|
|
||
| [Parameter(ParameterSetName='Start', Mandatory, ValueFromPipeline)] | ||
| [Parameter(ParameterSetName='StartViaIdentity', Mandatory, ValueFromPipeline)] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Category('Body')] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Models.Api20191101Preview.IContainerRegistrySetupProperty] | ||
| # Container registry setup properties. | ||
| # To construct, see NOTES section for STARTSETUPREQUEST properties and create a hash table. | ||
| ${StartSetupRequest}, | ||
|
|
||
| [Parameter(ParameterSetName='StartExpanded')] | ||
| [Parameter(ParameterSetName='StartViaIdentityExpanded')] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Category('Body')] | ||
| [System.String] | ||
| # Input File for Certificate (Ssl certificate in base64 format.) | ||
| ${CertificateInputFile}, | ||
|
|
||
| [Parameter(ParameterSetName='StartExpanded')] | ||
| [Parameter(ParameterSetName='StartViaIdentityExpanded')] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Category('Body')] | ||
| [System.Security.SecureString] | ||
| # Ssl certificate password. | ||
| ${Password}, | ||
|
|
||
| [Parameter()] | ||
| [Alias('AzureRMContext', 'AzureCredential')] | ||
| [ValidateNotNull()] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Category('Azure')] | ||
| [System.Management.Automation.PSObject] | ||
| # The credentials, account, tenant, and subscription used for communication with Azure. | ||
| ${DefaultProfile}, | ||
|
|
||
| [Parameter(DontShow)] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Category('Runtime')] | ||
| [System.Management.Automation.SwitchParameter] | ||
| # Wait for .NET debugger to attach | ||
| ${Break}, | ||
|
|
||
| [Parameter(DontShow)] | ||
| [ValidateNotNull()] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Category('Runtime')] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Runtime.SendAsyncStep[]] | ||
| # SendAsync Pipeline Steps to be appended to the front of the pipeline | ||
| ${HttpPipelineAppend}, | ||
|
|
||
| [Parameter(DontShow)] | ||
| [ValidateNotNull()] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Category('Runtime')] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Runtime.SendAsyncStep[]] | ||
| # SendAsync Pipeline Steps to be prepended to the front of the pipeline | ||
| ${HttpPipelinePrepend}, | ||
|
|
||
| [Parameter(DontShow)] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Category('Runtime')] | ||
| [System.Uri] | ||
| # The URI for the proxy server to use | ||
| ${Proxy}, | ||
|
|
||
| [Parameter(DontShow)] | ||
| [ValidateNotNull()] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Category('Runtime')] | ||
| [System.Management.Automation.PSCredential] | ||
| # Credentials for a proxy server to use for the remote call | ||
| ${ProxyCredential}, | ||
|
|
||
| [Parameter(DontShow)] | ||
| [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistryAdmin.Category('Runtime')] | ||
| [System.Management.Automation.SwitchParameter] | ||
| # Use the default credentials for the proxy | ||
| ${ProxyUseDefaultCredentials} | ||
| ) | ||
|
|
||
| begin { | ||
| try { | ||
| $outBuffer = $null | ||
| if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { | ||
| $PSBoundParameters['OutBuffer'] = 1 | ||
| } | ||
| $parameterSet = $PSCmdlet.ParameterSetName | ||
| $mapping = @{ | ||
| Start = 'Azs.ContainerRegistry.Admin.private\Start-AzsContainerRegistrySetup_Start'; | ||
| StartExpanded = 'Azs.ContainerRegistry.Admin.private\Start-AzsContainerRegistrySetup_StartExpanded'; | ||
| StartViaIdentity = 'Azs.ContainerRegistry.Admin.private\Start-AzsContainerRegistrySetup_StartViaIdentity'; | ||
| StartViaIdentityExpanded = 'Azs.ContainerRegistry.Admin.private\Start-AzsContainerRegistrySetup_StartViaIdentityExpanded'; | ||
| } | ||
| if (('Start', 'StartExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('Location')) { | ||
| $PSBoundParameters['Location'] = (Get-AzLocation)[0].Location | ||
| } | ||
| if (('Start', 'StartExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { | ||
| $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id | ||
| } | ||
| $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) | ||
| $scriptCmd = {& $wrappedCmd @PSBoundParameters} | ||
| $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) | ||
| $steppablePipeline.Begin($PSCmdlet) | ||
| } catch { | ||
| throw | ||
| } | ||
| } | ||
|
|
||
| process { | ||
|
|
||
| # Basic validation should be present in powershell for PFX file | ||
| if ($PSBoundParameters.ContainsKey(('CertificateInputFile'))) | ||
| { | ||
| if (!(Test-Path -Path $CertificateInputFile -PathType Leaf)) | ||
| { | ||
| throw "The specified ssl cert $CertificateInputFile does not exist." | ||
| } | ||
|
|
||
| if ([IO.Path]::GetExtension($CertificateInputFile) -ne ".pfx" ) | ||
| { | ||
| throw "The specified file $CertificateInputFile is not cert with private key." | ||
| } | ||
| } | ||
| } | ||
|
|
||
| end { | ||
| try { | ||
| $steppablePipeline.End() | ||
| } catch { | ||
| throw | ||
| } | ||
| } | ||
| } | ||
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
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
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.