1
+ # ----------------------------------------------------------------------------------
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+ # Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code
13
+ # is regenerated.
14
+ # ----------------------------------------------------------------------------------
15
+
16
+ <#
17
+ . Synopsis
18
+ Generate keys for a token of a specified container registry.
19
+ . Description
20
+ Generate keys for a token of a specified container registry.
21
+ . Example
22
+ New-AzContainerRegistryCredentials -TokenId /subscriptions/xxxx/resourceGroups/MyResourceGroup/providers/Microsoft.ContainerRegistry/registries/myRegistry/tokens/mytoken -RegistryName myRegistry -ResourceGroupName MyResourceGroup
23
+
24
+ . Inputs
25
+ Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Models.IContainerRegistryIdentity
26
+ . Outputs
27
+ Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Models.Api202301Preview.IGenerateCredentialsResult
28
+ . Notes
29
+ COMPLEX PARAMETER PROPERTIES
30
+
31
+ 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.
32
+
33
+ INPUTOBJECT <IContainerRegistryIdentity>: Identity Parameter
34
+ [AgentPoolName <String>]: The name of the agent pool.
35
+ [CacheRuleName <String>]: The name of the cache rule.
36
+ [ConnectedRegistryName <String>]: The name of the connected registry.
37
+ [CredentialSetName <String>]: The name of the credential set.
38
+ [ExportPipelineName <String>]: The name of the export pipeline.
39
+ [GroupName <String>]: The name of the private link resource.
40
+ [Id <String>]: Resource identity path
41
+ [ImportPipelineName <String>]: The name of the import pipeline.
42
+ [PipelineRunName <String>]: The name of the pipeline run.
43
+ [PrivateEndpointConnectionName <String>]: The name of the private endpoint connection.
44
+ [RegistryName <String>]: The name of the container registry.
45
+ [ReplicationName <String>]: The name of the replication.
46
+ [ResourceGroupName <String>]: The name of the resource group. The name is case insensitive.
47
+ [RunId <String>]: The run ID.
48
+ [ScopeMapName <String>]: The name of the scope map.
49
+ [SubscriptionId <String>]: The ID of the target subscription. The value must be an UUID.
50
+ [TaskName <String>]: The name of the container registry task.
51
+ [TaskRunName <String>]: The name of the task run.
52
+ [TokenName <String>]: The name of the token.
53
+ [WebhookName <String>]: The name of the webhook.
54
+ . Link
55
+ https://learn.microsoft.com/powershell/module/az.containerregistry/new-azcontainerregistrycredentials
56
+ #>
57
+ function New-AzContainerRegistryCredentials {
58
+ [OutputType ([Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Models.Api202301Preview.PSContainerRegistryCredential ])]
59
+ [CmdletBinding (DefaultParameterSetName = ' GenerateExpanded' , PositionalBinding = $false , SupportsShouldProcess , ConfirmImpact = ' Medium' )]
60
+ param (
61
+ [Parameter (ParameterSetName = ' GenerateExpanded' , Mandatory )]
62
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Category (' Path' )]
63
+ [System.String ]
64
+ # The name of the container registry.
65
+ ${RegistryName} ,
66
+
67
+ [Parameter (ParameterSetName = ' GenerateExpanded' , Mandatory )]
68
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Category (' Path' )]
69
+ [System.String ]
70
+ # The name of the resource group.
71
+ # The name is case insensitive.
72
+ ${ResourceGroupName} ,
73
+
74
+ [Parameter (ParameterSetName = ' GenerateExpanded' )]
75
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Category (' Path' )]
76
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Runtime.DefaultInfo (Script= ' (Get-AzContext).Subscription.Id' )]
77
+ [System.String ]
78
+ # The ID of the target subscription.
79
+ # The value must be an UUID.
80
+ ${SubscriptionId} ,
81
+
82
+ [Parameter (ParameterSetName = ' GenerateViaIdentityExpanded' , Mandatory , ValueFromPipeline )]
83
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Category (' Path' )]
84
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Models.IContainerRegistryIdentity ]
85
+ # Identity Parameter
86
+ # To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
87
+ ${InputObject} ,
88
+
89
+ [Parameter ()]
90
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Category (' Body' )]
91
+ [System.DateTime ]
92
+ # The expiry date of the generated credentials after which the credentials become invalid.
93
+ ${Expiry} ,
94
+
95
+ [Parameter ()]
96
+ [ArgumentCompleter ([Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Support.TokenPasswordName ])]
97
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Category (' Body' )]
98
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Support.TokenPasswordName ]
99
+ # Specifies name of the password which should be regenerated if any -- password1 or password2.
100
+ ${Name} ,
101
+
102
+ [Parameter ()]
103
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Category (' Body' )]
104
+ [System.String ]
105
+ # The resource ID of the token for which credentials have to be generated.
106
+ ${TokenId} ,
107
+
108
+ [Parameter ()]
109
+ [Alias (' AzureRMContext' , ' AzureCredential' )]
110
+ [ValidateNotNull ()]
111
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Category (' Azure' )]
112
+ [System.Management.Automation.PSObject ]
113
+ # The DefaultProfile parameter is not functional.
114
+ # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
115
+ ${DefaultProfile} ,
116
+
117
+ [Parameter ()]
118
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Category (' Runtime' )]
119
+ [System.Management.Automation.SwitchParameter ]
120
+ # Run the command as a job
121
+ ${AsJob} ,
122
+
123
+ [Parameter (DontShow)]
124
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Category (' Runtime' )]
125
+ [System.Management.Automation.SwitchParameter ]
126
+ # Wait for .NET debugger to attach
127
+ ${Break} ,
128
+
129
+ [Parameter (DontShow)]
130
+ [ValidateNotNull ()]
131
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Category (' Runtime' )]
132
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Runtime.SendAsyncStep []]
133
+ # SendAsync Pipeline Steps to be appended to the front of the pipeline
134
+ ${HttpPipelineAppend} ,
135
+
136
+ [Parameter (DontShow)]
137
+ [ValidateNotNull ()]
138
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Category (' Runtime' )]
139
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Runtime.SendAsyncStep []]
140
+ # SendAsync Pipeline Steps to be prepended to the front of the pipeline
141
+ ${HttpPipelinePrepend} ,
142
+
143
+ [Parameter ()]
144
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Category (' Runtime' )]
145
+ [System.Management.Automation.SwitchParameter ]
146
+ # Run the command asynchronously
147
+ ${NoWait} ,
148
+
149
+ [Parameter (DontShow)]
150
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Category (' Runtime' )]
151
+ [System.Uri ]
152
+ # The URI for the proxy server to use
153
+ ${Proxy} ,
154
+
155
+ [Parameter (DontShow)]
156
+ [ValidateNotNull ()]
157
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Category (' Runtime' )]
158
+ [System.Management.Automation.PSCredential ]
159
+ # Credentials for a proxy server to use for the remote call
160
+ ${ProxyCredential} ,
161
+
162
+ [Parameter (DontShow)]
163
+ [Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Category (' Runtime' )]
164
+ [System.Management.Automation.SwitchParameter ]
165
+ # Use the default credentials for the proxy
166
+ ${ProxyUseDefaultCredentials}
167
+ )
168
+
169
+ process {
170
+ $Credential = Az.ContainerRegistry.internal\New-AzContainerRegistryCredentials @PSBoundParameters
171
+ $Result = New-Object Microsoft.Azure.PowerShell.Cmdlets.ContainerRegistry.Models.Api202301Preview.PSContainerRegistryCredential($Credential )
172
+ return $Result
173
+ }
174
+ }
175
+
0 commit comments