diff --git a/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/custom/New-AzConnectedKubernetes.ps1 b/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/custom/New-AzConnectedKubernetes.ps1 index fbe8ff4943d9..ae5f195c02cc 100644 --- a/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/custom/New-AzConnectedKubernetes.ps1 +++ b/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/custom/New-AzConnectedKubernetes.ps1 @@ -439,8 +439,9 @@ function New-AzConnectedKubernetes { $options = "" if ($DisableAutoUpgrade) { - $options += " --set systemDefaultValues.azureArcAgents.autoUpdate=false" + # $options += " --set systemDefaultValues.azureArcAgents.autoUpdate=false" $Null = $PSBoundParameters.Remove('DisableAutoUpgrade') + $PSBoundParameters.Add('ArcAgentProfileAgentAutoUpgrade', 'Disabled') } if (-not ([string]::IsNullOrEmpty($ContainerLogPath))) { $options += " --set systemDefaultValues.fluent-bit.containerLogPath=$ContainerLogPath" @@ -599,9 +600,14 @@ function New-AzConnectedKubernetes { $PSBoundParameters.Add('ArcAgentryConfiguration', $arcAgentryConfigs) - Write-Verbose "Creating 'Kubernetes - Azure Arc' object in Azure" + Write-Output "Creating 'Kubernetes - Azure Arc' object in Azure" $Response = Az.ConnectedKubernetes.internal\New-AzConnectedKubernetes @PSBoundParameters + if ((-not $WhatIfPreference) -and (-not $Response)) { + Write-Error "Failed to create the 'Kubernetes - Azure Arc' resource." + return + } + $arcAgentryConfigs = ConvertTo-ArcAgentryConfiguration -ConfigurationSetting $ConfigurationSetting -RedactedProtectedConfiguration $RedactedProtectedConfiguration -CCRP $false # Convert the $Response object into a nested hashtable. @@ -676,6 +682,7 @@ function New-AzConnectedKubernetes { $options += " --debug" } if ($PSCmdlet.ShouldProcess($ClusterName, "Update Kubernetes cluster with Azure Arc")) { + Write-Output "Executing helm upgrade command, this can take a few minutes...." try { helm upgrade ` --install azure-arc ` @@ -705,7 +712,7 @@ function New-AzConnectedKubernetes { if ($PSBoundParameters.ContainsKey('OidcIssuerProfileEnabled') -or $PSBoundParameters.ContainsKey('WorkloadIdentityEnabled') ) { $ExistConnectedKubernetes = Get-AzConnectedKubernetes -ResourceGroupName $ResourceGroupName -ClusterName $ClusterName @CommonPSBoundParameters - Write-Host "Cluster configuration is in progress..." + Write-Output "Cluster configuration is in progress..." $timeout = [datetime]::Now.AddMinutes(60) while (($ExistConnectedKubernetes.ArcAgentProfileAgentState -ne "Succeeded") -and ($ExistConnectedKubernetes.ArcAgentProfileAgentState -ne "Failed") -and ([datetime]::Now -lt $timeout)) { @@ -714,7 +721,7 @@ function New-AzConnectedKubernetes { } if ($ExistConnectedKubernetes.ArcAgentProfileAgentState -eq "Succeeded") { - Write-Host "Cluster configuration succeeded." + Write-Output "Cluster configuration succeeded." } elseif ($ExistConnectedKubernetes.ArcAgentProfileAgentState -eq "Failed") { Write-Error "Cluster configuration failed." } else { diff --git a/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/custom/Set-AzConnectedKubernetes.ps1 b/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/custom/Set-AzConnectedKubernetes.ps1 index 45d806c7c848..04e622568316 100644 --- a/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/custom/Set-AzConnectedKubernetes.ps1 +++ b/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/custom/Set-AzConnectedKubernetes.ps1 @@ -25,7 +25,7 @@ API to set properties of the connected cluster resource .Description API to set properties of the connected cluster resource .Example -Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -EnableGateway -GatewayResourceId $gatewayResourceId +Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -GatewayResourceId $gatewayResourceId .Example Set-AzConnectedKubernetes -ClusterName azps_test_cluster1 -ResourceGroupName azps_test_group -Location eastus -KubeConfig $HOME\.kube\config -KubeContext azps_aks_t01 -DisableGateway @@ -87,7 +87,6 @@ function Set-AzConnectedKubernetes { Justification = 'Code published before this issue was identified')] param( [Parameter(ParameterSetName = 'SetExpanded', Mandatory)] - [Parameter(ParameterSetName = 'SetExpandedEnableGateway', Mandatory)] [Parameter(ParameterSetName = 'SetExpandedDisableGateway', Mandatory)] [Alias('Name')] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('Path')] @@ -96,7 +95,6 @@ function Set-AzConnectedKubernetes { ${ClusterName}, [Parameter(ParameterSetName = 'SetExpanded', Mandatory)] - [Parameter(ParameterSetName = 'SetExpandedEnableGateway', Mandatory)] [Parameter(ParameterSetName = 'SetExpandedDisableGateway', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('Path')] [System.String] @@ -105,7 +103,6 @@ function Set-AzConnectedKubernetes { ${ResourceGroupName}, [Parameter(ParameterSetName = 'SetExpanded', Mandatory)] - [Parameter(ParameterSetName = 'SetExpandedEnableGateway', Mandatory)] [Parameter(ParameterSetName = 'SetExpandedDisableGateway', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('Body')] [System.String] @@ -113,7 +110,6 @@ function Set-AzConnectedKubernetes { ${Location}, [Parameter(ParameterSetName = 'Set', Mandatory)] - [Parameter(ParameterSetName = 'SetEnableGateway', Mandatory)] [Parameter(ParameterSetName = 'SetDisableGateway', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('Body')] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Models.Api20240715Preview.IConnectedCluster] @@ -326,12 +322,6 @@ function Set-AzConnectedKubernetes { # Arc Agentry System Protected Configuration ${ConfigurationProtectedSetting}, - [Parameter(ParameterSetName = 'SetEnableGateway', Mandatory)] - [Parameter(ParameterSetName = 'SetExpandedEnableGateway', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('body')] - [System.Management.Automation.SwitchParameter] - ${EnableGateway}, - [Parameter(ParameterSetName = 'SetDisableGateway', Mandatory)] [Parameter(ParameterSetName = 'SetExpandedDisableGateway', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('body')] @@ -341,7 +331,7 @@ function Set-AzConnectedKubernetes { [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('body')] [System.String] - # Arc Gateway resource Id + # Arc Gateway resource Id, providing this will enable the gateway ${GatewayResourceId} ) @@ -415,10 +405,7 @@ function Set-AzConnectedKubernetes { $ResourceGroupName = $InputObject.ResourceGroupName $PSBoundParameters.Add('ResourceGroupName', $ResourceGroupName) - if ((-not $PSBoundParameters.ContainsKey('EnableGateway')) -and (-not $PSBoundParameters.ContainsKey('DisableGateway'))) { - if ($InputObject.GatewayEnabled) { - $EnableGateway = $InputObject.GatewayEnabled - } + if (-not $PSBoundParameters.ContainsKey('DisableGateway')) { if (-not $InputObject.GatewayEnabled) { $DisableGateway = -not $InputObject.GatewayEnabled } @@ -427,11 +414,14 @@ function Set-AzConnectedKubernetes { $GatewayResourceId = $InputObject.GatewayResourceId $PSBoundParameters.Add('GatewayResourceId', $GatewayResourceId) } + + if (-not $PSBoundParameters.ContainsKey('DisableAutoUpgrade')) { + $DisableAutoUpgrade = ($InputObject.ArcAgentProfileAgentAutoUpgrade -eq 'Disabled') + } } - if ($EnableGateway) { + if (-not [String]::IsNullOrEmpty($GatewayResourceId) -and -not $DisableGateway) { Write-Debug "Gateway enabled" - $Null = $PSBoundParameters.Remove('EnableGateway') $PSBoundParameters.Add('GatewayEnabled', $true) } # If DisableGateway is provided then set the gateway as disabled and remove gateway resourceId from parameters @@ -472,7 +462,6 @@ function Set-AzConnectedKubernetes { $ReleaseNamespace = $ReleaseNamespaces['ReleaseNamespace'] $ReleaseInstallNamespace = $ReleaseNamespaces['ReleaseInstallNamespace'] - #Endregion #Region validate release namespace @@ -511,9 +500,9 @@ function Set-AzConnectedKubernetes { $options = "" - if ($DisableAutoUpgrade) { - $options += " --set systemDefaultValues.azureArcAgents.autoUpdate=false" + if ($DisableAutoUpgrade -or ($ExistConnectedKubernetes.ArcAgentProfileAgentAutoUpgrade -eq 'Disabled')) { $Null = $PSBoundParameters.Remove('DisableAutoUpgrade') + $PSBoundParameters.Add('ArcAgentProfileAgentAutoUpgrade', 'Disabled') } if (-not ([string]::IsNullOrEmpty($ContainerLogPath))) { $options += " --set systemDefaultValues.fluent-bit.containerLogPath=$ContainerLogPath" @@ -549,6 +538,17 @@ function Set-AzConnectedKubernetes { #Endregion #Region Deal with configuration settings and protected settings + + # If the user does not provide proxy settings, or configuration settings, we shall use arc config of existing object + $userProvidedArcConfiguration = ( + ($null -ne $InputObject) -and ($InputObject.ArcAgentryConfiguration.Length > 0) ` + -and (-not ([string]::IsNullOrEmpty($HttpProxy))) ` + -and (-not ([string]::IsNullOrEmpty($HttpsProxy))) ` + -and (-not ([string]::IsNullOrEmpty($NoProxy))) ` + -and ((-not ([string]::IsNullOrEmpty($ProxyCert)))) ` + -and ($PSBoundParameters.ContainsKey('ConfigurationSetting')) ` + -and ($PSBoundParameters.ContainsKey('ConfigurationProtectedSetting'))) + if ($null -eq $ConfigurationSetting) { $ConfigurationSetting = @{} } @@ -654,9 +654,18 @@ function Set-AzConnectedKubernetes { $PSBoundParameters.Remove('ConfigurationProtectedSetting') } - $PSBoundParameters.Add('ArcAgentryConfiguration', $arcAgentryConfigs) + if ($userProvidedArcConfiguration) { + $PSBoundParameters.Add('ArcAgentryConfiguration', $arcAgentryConfigs) + } else { + $PSBoundParameters.Add('ArcAgentryConfiguration', $ExistConnectedKubernetes.ArcAgentryConfiguration) + } + Write-Output "Updating the connected cluster resource...." $Response = Az.ConnectedKubernetes.internal\Set-AzConnectedKubernetes @PSBoundParameters + if ((-not $WhatIfPreference) -and (-not $Response)) { + Write-Error "Failed to update the 'Kubernetes - Azure Arc' resource" + return + } $arcAgentryConfigs = ConvertTo-ArcAgentryConfiguration -ConfigurationSetting $ConfigurationSetting -RedactedProtectedConfiguration $RedactedProtectedConfiguration -CCRP $false # Convert the $Response object into a nested hashtable. @@ -671,13 +680,20 @@ function Set-AzConnectedKubernetes { $Response['properties'] = @{} } - $Response['properties']['arcAgentryConfigurations'] = $arcAgentryConfigs + if ($userProvidedArcConfiguration) { + $Response['properties']['arcAgentryConfigurations'] = $arcAgentryConfigs + } else { + $Response['properties']['arcAgentryConfigurations'] = $ExistConnectedKubernetes.ArcAgentryConfiguration + } + # Retrieving Helm chart OCI (Open Container Initiative) Artifact location Write-Debug "Retrieving Helm chart OCI (Open Container Initiative) Artifact location." $ResponseStr = $Response | ConvertTo-Json -Depth 10 Write-Debug "PUT response: $ResponseStr" + Write-Output "Preparing helm ...." + if ($PSCmdlet.ShouldProcess('configDP', 'get helm values from config DP')) { $helmValuesDp = Get-HelmValuesFromConfigDP ` -configDPEndpoint $configDPEndpoint ` @@ -741,6 +757,7 @@ function Set-AzConnectedKubernetes { } } + Write-Output "Executing helm upgrade, this can take a few minutes ...." Write-Debug $options -ErrorAction Continue if ($DebugPreference -eq "Continue") { $options += " --debug" @@ -765,7 +782,7 @@ function Set-AzConnectedKubernetes { if ($PSBoundParameters.ContainsKey('OidcIssuerProfileEnabled') -or $PSBoundParameters.ContainsKey('WorkloadIdentityEnabled') ) { $ExistConnectedKubernetes = Get-AzConnectedKubernetes -ResourceGroupName $ResourceGroupName -ClusterName $ClusterName @CommonPSBoundParameters - Write-Host "Cluster configuration is in progress..." + Write-Output "Cluster configuration is in progress..." $timeout = [datetime]::Now.AddMinutes(60) while (($ExistConnectedKubernetes.ArcAgentProfileAgentState -ne "Succeeded") -and ($ExistConnectedKubernetes.ArcAgentProfileAgentState -ne "Failed") -and ([datetime]::Now -lt $timeout)) { @@ -774,7 +791,7 @@ function Set-AzConnectedKubernetes { } if ($ExistConnectedKubernetes.ArcAgentProfileAgentState -eq "Succeeded") { - Write-Host "Cluster configuration succeeded." + Write-Output "Cluster configuration succeeded." } elseif ($ExistConnectedKubernetes.ArcAgentProfileAgentState -eq "Failed") { Write-Error "Cluster configuration failed." } else { diff --git a/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/examples/Set-AzConnectedKubernetes.md b/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/examples/Set-AzConnectedKubernetes.md index ee4dc09a506a..05f2cf83ee5b 100644 --- a/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/examples/Set-AzConnectedKubernetes.md +++ b/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/examples/Set-AzConnectedKubernetes.md @@ -1,4 +1,4 @@ -### Example 1: Disable gateway feature of a connected kubernetes. +### Example 1: Disable gateway feature of a connected kubernetes. ```powershell Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -DisableGateway ``` @@ -13,7 +13,7 @@ This command disable gateway feature of a connected kubernetes. ### Example 2: Enable gateway feature of connected kubernetes. ```powershell -Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -EnableGateway -GatewayResourceId gatewayResourceId +Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -GatewayResourceId gatewayResourceId ``` diff --git a/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/exports/ProxyCmdletDefinitions.ps1 b/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/exports/ProxyCmdletDefinitions.ps1 index 67831a2619ac..92a9a34fbac7 100644 --- a/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/exports/ProxyCmdletDefinitions.ps1 +++ b/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/exports/ProxyCmdletDefinitions.ps1 @@ -1021,7 +1021,7 @@ API to set properties of the connected cluster resource .Example Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -DisableGateway .Example -Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -EnableGateway -GatewayResourceId gatewayResourceId +Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -GatewayResourceId gatewayResourceId .Outputs @@ -1081,7 +1081,6 @@ function Set-AzConnectedKubernetes { param( [Parameter(ParameterSetName='SetExpanded', Mandatory)] [Parameter(ParameterSetName='SetExpandedDisableGateway', Mandatory)] - [Parameter(ParameterSetName='SetExpandedEnableGateway', Mandatory)] [Alias('Name')] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('Path')] [System.String] @@ -1090,7 +1089,6 @@ param( [Parameter(ParameterSetName='SetExpanded', Mandatory)] [Parameter(ParameterSetName='SetExpandedDisableGateway', Mandatory)] - [Parameter(ParameterSetName='SetExpandedEnableGateway', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('Path')] [System.String] # The name of the resource group. @@ -1142,7 +1140,6 @@ param( [Parameter(ParameterSetName='SetExpanded', Mandatory)] [Parameter(ParameterSetName='SetExpandedDisableGateway', Mandatory)] - [Parameter(ParameterSetName='SetExpandedEnableGateway', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('Body')] [System.String] # The geo-location where the resource lives @@ -1257,7 +1254,7 @@ param( [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('Body')] [System.String] - # Arc Gateway resource Id + # Arc Gateway resource Id, providing this will enable the gateway ${GatewayResourceId}, [Parameter(ParameterSetName='SetExpandedDisableGateway', Mandatory)] @@ -1266,14 +1263,7 @@ param( [System.Management.Automation.SwitchParameter] ${DisableGateway}, - [Parameter(ParameterSetName='SetExpandedEnableGateway', Mandatory)] - [Parameter(ParameterSetName='SetEnableGateway', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('Body')] - [System.Management.Automation.SwitchParameter] - ${EnableGateway}, - [Parameter(ParameterSetName='SetDisableGateway', Mandatory)] - [Parameter(ParameterSetName='SetEnableGateway', Mandatory)] [Parameter(ParameterSetName='Set', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('Body')] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Models.Api20240715Preview.IConnectedCluster] @@ -1368,12 +1358,10 @@ begin { $mapping = @{ SetExpanded = 'Az.ConnectedKubernetes.custom\Set-AzConnectedKubernetes'; SetExpandedDisableGateway = 'Az.ConnectedKubernetes.custom\Set-AzConnectedKubernetes'; - SetExpandedEnableGateway = 'Az.ConnectedKubernetes.custom\Set-AzConnectedKubernetes'; SetDisableGateway = 'Az.ConnectedKubernetes.custom\Set-AzConnectedKubernetes'; - SetEnableGateway = 'Az.ConnectedKubernetes.custom\Set-AzConnectedKubernetes'; Set = 'Az.ConnectedKubernetes.custom\Set-AzConnectedKubernetes'; } - if (('SetExpanded', 'SetExpandedDisableGateway', 'SetExpandedEnableGateway', 'SetDisableGateway', 'SetEnableGateway', 'Set') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + if (('SetExpanded', 'SetExpandedDisableGateway', 'SetDisableGateway', 'Set') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { $testPlayback = $false $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } if ($testPlayback) { diff --git a/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/exports/Set-AzConnectedKubernetes.ps1 b/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/exports/Set-AzConnectedKubernetes.ps1 index f5d97a581790..7406b104aed9 100644 --- a/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/exports/Set-AzConnectedKubernetes.ps1 +++ b/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/exports/Set-AzConnectedKubernetes.ps1 @@ -22,7 +22,7 @@ API to set properties of the connected cluster resource .Example Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -DisableGateway .Example -Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -EnableGateway -GatewayResourceId gatewayResourceId +Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -GatewayResourceId gatewayResourceId .Outputs @@ -82,7 +82,6 @@ function Set-AzConnectedKubernetes { param( [Parameter(ParameterSetName='SetExpanded', Mandatory)] [Parameter(ParameterSetName='SetExpandedDisableGateway', Mandatory)] - [Parameter(ParameterSetName='SetExpandedEnableGateway', Mandatory)] [Alias('Name')] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('Path')] [System.String] @@ -91,7 +90,6 @@ param( [Parameter(ParameterSetName='SetExpanded', Mandatory)] [Parameter(ParameterSetName='SetExpandedDisableGateway', Mandatory)] - [Parameter(ParameterSetName='SetExpandedEnableGateway', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('Path')] [System.String] # The name of the resource group. @@ -143,7 +141,6 @@ param( [Parameter(ParameterSetName='SetExpanded', Mandatory)] [Parameter(ParameterSetName='SetExpandedDisableGateway', Mandatory)] - [Parameter(ParameterSetName='SetExpandedEnableGateway', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('Body')] [System.String] # The geo-location where the resource lives @@ -258,7 +255,7 @@ param( [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('Body')] [System.String] - # Arc Gateway resource Id + # Arc Gateway resource Id, providing this will enable the gateway ${GatewayResourceId}, [Parameter(ParameterSetName='SetExpandedDisableGateway', Mandatory)] @@ -267,14 +264,7 @@ param( [System.Management.Automation.SwitchParameter] ${DisableGateway}, - [Parameter(ParameterSetName='SetExpandedEnableGateway', Mandatory)] - [Parameter(ParameterSetName='SetEnableGateway', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('Body')] - [System.Management.Automation.SwitchParameter] - ${EnableGateway}, - [Parameter(ParameterSetName='SetDisableGateway', Mandatory)] - [Parameter(ParameterSetName='SetEnableGateway', Mandatory)] [Parameter(ParameterSetName='Set', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Category('Body')] [Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Models.Api20240715Preview.IConnectedCluster] @@ -369,12 +359,10 @@ begin { $mapping = @{ SetExpanded = 'Az.ConnectedKubernetes.custom\Set-AzConnectedKubernetes'; SetExpandedDisableGateway = 'Az.ConnectedKubernetes.custom\Set-AzConnectedKubernetes'; - SetExpandedEnableGateway = 'Az.ConnectedKubernetes.custom\Set-AzConnectedKubernetes'; SetDisableGateway = 'Az.ConnectedKubernetes.custom\Set-AzConnectedKubernetes'; - SetEnableGateway = 'Az.ConnectedKubernetes.custom\Set-AzConnectedKubernetes'; Set = 'Az.ConnectedKubernetes.custom\Set-AzConnectedKubernetes'; } - if (('SetExpanded', 'SetExpandedDisableGateway', 'SetExpandedEnableGateway', 'SetDisableGateway', 'SetEnableGateway', 'Set') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + if (('SetExpanded', 'SetExpandedDisableGateway', 'SetDisableGateway', 'Set') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { $testPlayback = $false $PSBoundParameters['HttpPipelinePrepend'] | Foreach-Object { if ($_) { $testPlayback = $testPlayback -or ('Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Runtime.PipelineMock' -eq $_.Target.GetType().FullName -and 'Playback' -eq $_.Target.Mode) } } if ($testPlayback) { diff --git a/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/help/Set-AzConnectedKubernetes.md b/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/help/Set-AzConnectedKubernetes.md index 51fad5d96dfc..69e4c597ed4d 100644 --- a/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/help/Set-AzConnectedKubernetes.md +++ b/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/help/Set-AzConnectedKubernetes.md @@ -54,20 +54,6 @@ Set-AzConnectedKubernetes -DisableGateway -InputObject [-Con [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] ``` -### SetEnableGateway -``` -Set-AzConnectedKubernetes -EnableGateway -InputObject [-ContainerLogPath ] - [-DisableAutoUpgrade] [-HttpProxy ] [-HttpsProxy ] [-NoProxy ] [-ProxyCert ] - [-SubscriptionId ] [-AcceptEULA] [-AzureHybridBenefit ] - [-ConfigurationProtectedSetting ] [-ConfigurationSetting ] - [-CustomLocationsOid ] [-Distribution ] [-DistributionVersion ] - [-GatewayResourceId ] [-Infrastructure ] [-KubeConfig ] [-KubeContext ] - [-OidcIssuerProfileEnabled] [-OidcIssuerProfileSelfHostedIssuerUrl ] - [-PrivateLinkScopeResourceId ] [-PrivateLinkState ] - [-ProvisioningState ] [-Tag ] [-WorkloadIdentityEnabled] - [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] -``` - ### SetExpandedDisableGateway ``` Set-AzConnectedKubernetes -ClusterName -ResourceGroupName -DisableGateway -Location @@ -82,26 +68,12 @@ Set-AzConnectedKubernetes -ClusterName -ResourceGroupName -Dis [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] ``` -### SetExpandedEnableGateway -``` -Set-AzConnectedKubernetes -ClusterName -ResourceGroupName -EnableGateway -Location - [-ContainerLogPath ] [-DisableAutoUpgrade] [-HttpProxy ] [-HttpsProxy ] [-NoProxy ] - [-ProxyCert ] [-SubscriptionId ] [-AcceptEULA] [-AzureHybridBenefit ] - [-ConfigurationProtectedSetting ] [-ConfigurationSetting ] - [-CustomLocationsOid ] [-Distribution ] [-DistributionVersion ] - [-GatewayResourceId ] [-Infrastructure ] [-KubeConfig ] [-KubeContext ] - [-OidcIssuerProfileEnabled] [-OidcIssuerProfileSelfHostedIssuerUrl ] - [-PrivateLinkScopeResourceId ] [-PrivateLinkState ] - [-ProvisioningState ] [-Tag ] [-WorkloadIdentityEnabled] - [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] -``` - ## DESCRIPTION API to set properties of the connected cluster resource ## EXAMPLES -### Example 1: Disable gateway feature of a connected kubernetes. +### Example 1: Disable gateway feature of a connected kubernetes. ```powershell Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -DisableGateway ``` @@ -116,7 +88,7 @@ This command disable gateway feature of a connected kubernetes. ### Example 2: Enable gateway feature of connected kubernetes. ```powershell -Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -EnableGateway -GatewayResourceId gatewayResourceId +Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -GatewayResourceId gatewayResourceId ``` @@ -180,7 +152,7 @@ The name of the Kubernetes cluster on which get is called. ```yaml Type: System.String -Parameter Sets: SetExpanded, SetExpandedDisableGateway, SetExpandedEnableGateway +Parameter Sets: SetExpanded, SetExpandedDisableGateway Aliases: Name Required: True @@ -325,23 +297,8 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -EnableGateway - - -```yaml -Type: System.Management.Automation.SwitchParameter -Parameter Sets: SetEnableGateway, SetExpandedEnableGateway -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -GatewayResourceId -Arc Gateway resource Id +Arc Gateway resource Id, providing this will enable the gateway ```yaml Type: System.String @@ -405,7 +362,7 @@ To construct, see NOTES section for INPUTOBJECT properties and create a hash tab ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Models.Api20240715Preview.IConnectedCluster -Parameter Sets: Set, SetDisableGateway, SetEnableGateway +Parameter Sets: Set, SetDisableGateway Aliases: Required: True @@ -450,7 +407,7 @@ The geo-location where the resource lives ```yaml Type: System.String -Parameter Sets: SetExpanded, SetExpandedDisableGateway, SetExpandedEnableGateway +Parameter Sets: SetExpanded, SetExpandedDisableGateway Aliases: Required: True @@ -586,7 +543,7 @@ The name is case insensitive. ```yaml Type: System.String -Parameter Sets: SetExpanded, SetExpandedDisableGateway, SetExpandedEnableGateway +Parameter Sets: SetExpanded, SetExpandedDisableGateway Aliases: Required: True diff --git a/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/internal/ProxyCmdletDefinitions.ps1 b/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/internal/ProxyCmdletDefinitions.ps1 index 5af1f76ed195..40278654d757 100644 --- a/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/internal/ProxyCmdletDefinitions.ps1 +++ b/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/internal/ProxyCmdletDefinitions.ps1 @@ -660,7 +660,7 @@ API to register a new Kubernetes cluster and create a tracked resource in Azure .Example Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -DisableGateway .Example -Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -EnableGateway -GatewayResourceId gatewayResourceId +Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -GatewayResourceId gatewayResourceId .Outputs diff --git a/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/internal/Set-AzConnectedKubernetes.ps1 b/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/internal/Set-AzConnectedKubernetes.ps1 index 0daf93be1ea9..36d5aeb903e9 100644 --- a/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/internal/Set-AzConnectedKubernetes.ps1 +++ b/src/ConnectedKubernetes/ConnectedKubernetes.Autorest/internal/Set-AzConnectedKubernetes.ps1 @@ -22,7 +22,7 @@ API to register a new Kubernetes cluster and create a tracked resource in Azure .Example Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -DisableGateway .Example -Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -EnableGateway -GatewayResourceId gatewayResourceId +Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -GatewayResourceId gatewayResourceId .Outputs diff --git a/src/ConnectedKubernetes/ConnectedKubernetes/Az.ConnectedKubernetes.psd1 b/src/ConnectedKubernetes/ConnectedKubernetes/Az.ConnectedKubernetes.psd1 index 9a454d60b89b..22791d64e902 100644 --- a/src/ConnectedKubernetes/ConnectedKubernetes/Az.ConnectedKubernetes.psd1 +++ b/src/ConnectedKubernetes/ConnectedKubernetes/Az.ConnectedKubernetes.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft Corporation # -# Generated on: 9/18/2024 +# Generated on: 9/24/2024 # @{ diff --git a/src/ConnectedKubernetes/ConnectedKubernetes/help/Set-AzConnectedKubernetes.md b/src/ConnectedKubernetes/ConnectedKubernetes/help/Set-AzConnectedKubernetes.md index 9248db641571..9b38d47ecf54 100644 --- a/src/ConnectedKubernetes/ConnectedKubernetes/help/Set-AzConnectedKubernetes.md +++ b/src/ConnectedKubernetes/ConnectedKubernetes/help/Set-AzConnectedKubernetes.md @@ -26,20 +26,6 @@ Set-AzConnectedKubernetes -ClusterName -ResourceGroupName [-Su [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` -### SetExpandedEnableGateway -``` -Set-AzConnectedKubernetes -ClusterName -ResourceGroupName [-SubscriptionId ] - [-HttpProxy ] [-HttpsProxy ] [-NoProxy ] [-ProxyCert ] [-DisableAutoUpgrade] - [-ContainerLogPath ] -Location [-KubeConfig ] [-KubeContext ] - [-AzureHybridBenefit ] [-Distribution ] [-DistributionVersion ] - [-Infrastructure ] [-PrivateLinkScopeResourceId ] [-PrivateLinkState ] - [-ProvisioningState ] [-Tag ] [-CustomLocationsOid ] - [-OidcIssuerProfileEnabled] [-OidcIssuerProfileSelfHostedIssuerUrl ] [-WorkloadIdentityEnabled] - [-AcceptEULA] [-ConfigurationSetting ] [-ConfigurationProtectedSetting ] - [-GatewayResourceId ] [-EnableGateway] [-DefaultProfile ] [-AsJob] [-NoWait] - [-ProgressAction ] [-WhatIf] [-Confirm] [] -``` - ### SetExpandedDisableGateway ``` Set-AzConnectedKubernetes -ClusterName -ResourceGroupName [-SubscriptionId ] @@ -68,20 +54,6 @@ Set-AzConnectedKubernetes [-SubscriptionId ] [-HttpProxy ] [-HttpsP [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` -### SetEnableGateway -``` -Set-AzConnectedKubernetes [-SubscriptionId ] [-HttpProxy ] [-HttpsProxy ] [-NoProxy ] - [-ProxyCert ] [-DisableAutoUpgrade] [-ContainerLogPath ] [-KubeConfig ] - [-KubeContext ] [-AzureHybridBenefit ] [-Distribution ] - [-DistributionVersion ] [-Infrastructure ] [-PrivateLinkScopeResourceId ] - [-PrivateLinkState ] [-ProvisioningState ] [-Tag ] - [-CustomLocationsOid ] [-OidcIssuerProfileEnabled] [-OidcIssuerProfileSelfHostedIssuerUrl ] - [-WorkloadIdentityEnabled] [-AcceptEULA] [-ConfigurationSetting ] - [-ConfigurationProtectedSetting ] [-GatewayResourceId ] [-EnableGateway] - -InputObject [-DefaultProfile ] [-AsJob] [-NoWait] - [-ProgressAction ] [-WhatIf] [-Confirm] [] -``` - ### Set ``` Set-AzConnectedKubernetes [-SubscriptionId ] [-HttpProxy ] [-HttpsProxy ] [-NoProxy ] @@ -101,7 +73,7 @@ API to set properties of the connected cluster resource ## EXAMPLES -### Example 1: Disable gateway feature of a connected kubernetes. +### Example 1: Disable gateway feature of a connected kubernetes. ```powershell Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -DisableGateway ``` @@ -116,7 +88,7 @@ This command disable gateway feature of a connected kubernetes. ### Example 2: Enable gateway feature of connected kubernetes. ```powershell -Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -EnableGateway -GatewayResourceId gatewayResourceId +Set-AzConnectedKubernetes -ClusterName azps_test_cluster -ResourceGroupName azps_test_group -Location eastus -GatewayResourceId gatewayResourceId ``` ```output @@ -179,7 +151,7 @@ The name of the Kubernetes cluster on which get is called. ```yaml Type: System.String -Parameter Sets: SetExpanded, SetExpandedEnableGateway, SetExpandedDisableGateway +Parameter Sets: SetExpanded, SetExpandedDisableGateway Aliases: Name Required: True @@ -323,22 +295,8 @@ Accept pipeline input: False Accept wildcard characters: False ``` -### -EnableGateway - -```yaml -Type: System.Management.Automation.SwitchParameter -Parameter Sets: SetExpandedEnableGateway, SetEnableGateway -Aliases: - -Required: True -Position: Named -Default value: None -Accept pipeline input: False -Accept wildcard characters: False -``` - ### -GatewayResourceId -Arc Gateway resource Id +Arc Gateway resource Id, providing this will enable the gateway ```yaml Type: System.String @@ -402,7 +360,7 @@ To construct, see NOTES section for INPUTOBJECT properties and create a hash tab ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.ConnectedKubernetes.Models.Api20240715Preview.IConnectedCluster -Parameter Sets: SetDisableGateway, SetEnableGateway, Set +Parameter Sets: SetDisableGateway, Set Aliases: Required: True @@ -447,7 +405,7 @@ The geo-location where the resource lives ```yaml Type: System.String -Parameter Sets: SetExpanded, SetExpandedEnableGateway, SetExpandedDisableGateway +Parameter Sets: SetExpanded, SetExpandedDisableGateway Aliases: Required: True @@ -598,7 +556,7 @@ The name is case insensitive. ```yaml Type: System.String -Parameter Sets: SetExpanded, SetExpandedEnableGateway, SetExpandedDisableGateway +Parameter Sets: SetExpanded, SetExpandedDisableGateway Aliases: Required: True