From 382f24adb1804698ed342fb6a6d892a96ca52e68 Mon Sep 17 00:00:00 2001 From: Francisco-Gamino Date: Mon, 16 May 2022 20:42:01 -0700 Subject: [PATCH 1/4] Build from the main branch --- src/Functions/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Functions/README.md b/src/Functions/README.md index c299ced7c63f..ce01fb4e2d9d 100644 --- a/src/Functions/README.md +++ b/src/Functions/README.md @@ -65,7 +65,7 @@ directive: ``` ``` yaml -branch: powershell-function +branch: main require: - $(this-folder)/../readme.azure.noprofile.md input-file: From 777c2f22ff5e9659d91ba66859900072f91db13d Mon Sep 17 00:00:00 2001 From: Francisco-Gamino Date: Mon, 16 May 2022 20:59:37 -0700 Subject: [PATCH 2/4] Write a warning message when setting values for parameters that are not provided --- src/Functions/custom/HelperFunctions.ps1 | 4 +++- src/Functions/custom/New-AzFunctionApp.ps1 | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Functions/custom/HelperFunctions.ps1 b/src/Functions/custom/HelperFunctions.ps1 index 62d9deb71562..3b1b93179f62 100644 --- a/src/Functions/custom/HelperFunctions.ps1 +++ b/src/Functions/custom/HelperFunctions.ps1 @@ -42,6 +42,8 @@ $constants["FunctionsNoV2Version"] = @( "USSec East" ) +$constants["SetDefaultValueParameterWarningMessage"] = "This default value is subject to change over time. Please set this value explicitly to ensure the behavior is not accidentally impacted by future changes." + foreach ($variableName in $constants.Keys) { if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue)) @@ -1018,7 +1020,7 @@ function GetRuntimeJsonDefinition $RuntimeVersion = $latestVersion.ToString() } - Write-Verbose "RuntimeVersion not specified. Setting default runtime version for '$Runtime' to '$RuntimeVersion'." -Verbose + Write-Warning "RuntimeVersion not specified. Setting default value to '$RuntimeVersion'. $SetDefaultValueParameterWarningMessage" } # Get the RuntimeJsonDefinition diff --git a/src/Functions/custom/New-AzFunctionApp.ps1 b/src/Functions/custom/New-AzFunctionApp.ps1 index 77378f3e8f40..12b41b93e1b8 100644 --- a/src/Functions/custom/New-AzFunctionApp.ps1 +++ b/src/Functions/custom/New-AzFunctionApp.ps1 @@ -266,7 +266,7 @@ function New-AzFunctionApp { } $FunctionsVersion = $DefaultFunctionsVersion - Write-Verbose "FunctionsVersion not specified. Setting default FunctionsVersion to '$FunctionsVersion'." -Verbose + Write-Warning "FunctionsVersion not specified. Setting default value to '$FunctionsVersion'. $SetDefaultValueParameterWarningMessage" } ValidateFunctionsVersion -FunctionsVersion $FunctionsVersion @@ -284,7 +284,7 @@ function New-AzFunctionApp { if (-not $OSType) { $OSType = GetDefaultOSType -Runtime $Runtime - Write-Verbose "OSType for $Runtime is '$OSType'." -Verbose + Write-Warning "OSType not specified. Setting default value to '$OSType'. $SetDefaultValueParameterWarningMessage" } $runtimeJsonDefintion = GetRuntimeJsonDefinition -FunctionsVersion $FunctionsVersion -Runtime $Runtime -RuntimeVersion $RuntimeVersion -OSType $OSType From 669b0c7de6fce4a935551c10f12d45405666d9c3 Mon Sep 17 00:00:00 2001 From: Francisco-Gamino Date: Mon, 16 May 2022 21:31:00 -0700 Subject: [PATCH 3/4] Update tests --- src/Functions/test/New-AzFunctionApp.Tests.ps1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Functions/test/New-AzFunctionApp.Tests.ps1 b/src/Functions/test/New-AzFunctionApp.Tests.ps1 index 1f7bc50d2ef7..a63cc8302817 100644 --- a/src/Functions/test/New-AzFunctionApp.Tests.ps1 +++ b/src/Functions/test/New-AzFunctionApp.Tests.ps1 @@ -128,11 +128,11 @@ Describe 'New-AzFunctionApp' { -FunctionsVersion $functionsVersion ` -WhatIf - } 4>&1 2>&1 > $filePath + } 3>&1 2>&1 > $filePath $logFileContent = Get-Content -Path $filePath -Raw $expectectedRuntimeVersion = $expectedDefaultRuntimeVersion[$OSType][$functionsVersion][$runtime] - $expectedMessage = "RuntimeVersion not specified. Setting default runtime version for '$runtime' to '$expectectedRuntimeVersion'." + $expectedMessage = "RuntimeVersion not specified. Setting default value to '$expectectedRuntimeVersion'." $logFileContent | Should Match $expectedMessage } finally @@ -234,12 +234,12 @@ Describe 'New-AzFunctionApp' { -RuntimeVersion $runtimeVersion ` -WhatIf - } 4>&1 2>&1 > $filePath + } 3>&1 2>&1 > $filePath $logFileContent = Get-Content -Path $filePath -Raw - $expectectedFunctionsVersionWarning = "FunctionsVersion not specified. Setting default FunctionsVersion to '$expectedFunctionsVersion'." - $expectectedOSTypeWarning = "OSType for $runtime is '$expectedOSType'." + $expectectedFunctionsVersionWarning = "FunctionsVersion not specified. Setting default value to '$expectedFunctionsVersion'." + $expectectedOSTypeWarning = "OSType not specified. Setting default value to '$expectedOSType'." $logFileContent | Should Match $expectectedFunctionsVersionWarning $logFileContent | Should Match $expectectedOSTypeWarning From bded45d4aa07f11de68c6eee9507eb8f509a0145 Mon Sep 17 00:00:00 2001 From: Yeming Liu <11371776+isra-fel@users.noreply.github.com> Date: Tue, 17 May 2022 13:52:39 +0800 Subject: [PATCH 4/4] try fix ci issue by sync Az.props and shared --- src/Az.props | 3 +++ src/shared/ConfigKeys.cs | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/shared/ConfigKeys.cs diff --git a/src/Az.props b/src/Az.props index f843183a882d..a372193dcbe7 100644 --- a/src/Az.props +++ b/src/Az.props @@ -34,6 +34,8 @@ true Resources.resx + + @@ -47,6 +49,7 @@ + diff --git a/src/shared/ConfigKeys.cs b/src/shared/ConfigKeys.cs new file mode 100644 index 000000000000..c3e067ddca5a --- /dev/null +++ b/src/shared/ConfigKeys.cs @@ -0,0 +1,32 @@ +// ---------------------------------------------------------------------------------- +// +// 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. +// ---------------------------------------------------------------------------------- + +namespace Microsoft.Azure.Commands.Shared.Config +{ + /// + /// This class stores keys of all the pre-defined configs. + /// + /// + /// All keys should be defined here. + /// If the key is used in Azure/azure-powershell-common repo, duplicate it in ConfigKeysForCommon class. + /// Keys defined here should NEVER be removed or changed to prevent breaking change. + /// + internal static class ConfigKeys + { + public const string EnableInterceptSurvey = "EnableInterceptSurvey"; + public const string DisplayBreakingChangeWarning = "DisplayBreakingChangeWarning"; + public const string DefaultSubscriptionForLogin = "DefaultSubscriptionForLogin"; + public const string EnableDataCollection = "EnableDataCollection"; + } +}