From 45018193548f386f46611faf3a7fb70f72dbef0b Mon Sep 17 00:00:00 2001 From: Yang Yuan Date: Mon, 10 Aug 2020 00:27:04 -0700 Subject: [PATCH 1/3] Show "NotPolice" legal terms for Face. --- .../CognitiveServices/CognitiveServices.csproj | 6 ++++++ .../NewAzureCognitiveServicesAccount.cs | 18 ++++++++++++++++++ .../Properties/Resources.Designer.cs | 13 +++++++++++-- .../Properties/Resources.resx | 3 +++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/CognitiveServices/CognitiveServices/CognitiveServices.csproj b/src/CognitiveServices/CognitiveServices/CognitiveServices.csproj index a3795812e78e..8777c489cff6 100644 --- a/src/CognitiveServices/CognitiveServices/CognitiveServices.csproj +++ b/src/CognitiveServices/CognitiveServices/CognitiveServices.csproj @@ -14,4 +14,10 @@ + + + True + + + \ No newline at end of file diff --git a/src/CognitiveServices/CognitiveServices/CognitiveServicesAccount/NewAzureCognitiveServicesAccount.cs b/src/CognitiveServices/CognitiveServices/CognitiveServicesAccount/NewAzureCognitiveServicesAccount.cs index 93d0f805d0e2..452fc7c975ae 100644 --- a/src/CognitiveServices/CognitiveServices/CognitiveServicesAccount/NewAzureCognitiveServicesAccount.cs +++ b/src/CognitiveServices/CognitiveServices/CognitiveServicesAccount/NewAzureCognitiveServicesAccount.cs @@ -245,6 +245,24 @@ public override void ExecuteCmdlet() } } } + + if (Type.Equals("Face", StringComparison.InvariantCultureIgnoreCase)) + { + if (Force.IsPresent) + { + WriteWarning(Resources.NewAccount_LegalTerm_NotPolice); + } + else + { + bool yesToAll = false, noToAll = false; + if (!ShouldContinue(Resources.NewAccount_LegalTerm_NotPolice, "Notice", true, ref yesToAll, ref noToAll)) + { + return; + } + } + } + + try { CognitiveServicesAccount createAccountResponse = CognitiveServicesClient.Accounts.Create( diff --git a/src/CognitiveServices/CognitiveServices/Properties/Resources.Designer.cs b/src/CognitiveServices/CognitiveServices/Properties/Resources.Designer.cs index 96221fd3282d..9cd6a1a18cd5 100644 --- a/src/CognitiveServices/CognitiveServices/Properties/Resources.Designer.cs +++ b/src/CognitiveServices/CognitiveServices/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Microsoft.Azure.Commands.Management.CognitiveServices.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -61,7 +61,16 @@ internal Resources() { } /// - /// Looks up a localized string similar to Microsoft will use data you send to Bing Search Services or the Translator Speech API to improve Microsoft products and services. Where you send personal data to these Cognitive Services, you are responsible for obtaining sufficient consent from the data subjects. The General Privacy and Security Terms in the Online Services Terms do not apply to these Cognitive Services. Please refer to the Microsoft Cognitive Services section in the Online Services Terms (https://www.microsoft.com/en-us/Licensing/product- [rest of string was truncated]";. + /// Looks up a localized string similar to I certify that use of this service is not by or for a police department in the United States.. + /// + internal static string NewAccount_LegalTerm_NotPolice { + get { + return ResourceManager.GetString("NewAccount_LegalTerm_NotPolice", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Microsoft will use data you send to Bing Search Services to improve Microsoft products and services. Where you send personal data to these Cognitive Services, you are responsible for obtaining sufficient consent from the data subjects. The General Privacy and Security Terms in the Online Services Terms do not apply to these Cognitive Services. Please refer to the Microsoft Cognitive Services section in the Online Services Terms (https://www.microsoft.com/en-us/Licensing/product-licensing/products.aspx) for [rest of string was truncated]";. /// internal static string NewAccount_Notice { get { diff --git a/src/CognitiveServices/CognitiveServices/Properties/Resources.resx b/src/CognitiveServices/CognitiveServices/Properties/Resources.resx index 7fcd0d82e10d..72c8cadbe9fa 100644 --- a/src/CognitiveServices/CognitiveServices/Properties/Resources.resx +++ b/src/CognitiveServices/CognitiveServices/Properties/Resources.resx @@ -120,6 +120,9 @@ Regenerating Key {0} for account {1}. + + I certify that use of this service is not by or for a police department in the United States. + Microsoft will use data you send to Bing Search Services to improve Microsoft products and services. Where you send personal data to these Cognitive Services, you are responsible for obtaining sufficient consent from the data subjects. The General Privacy and Security Terms in the Online Services Terms do not apply to these Cognitive Services. Please refer to the Microsoft Cognitive Services section in the Online Services Terms (https://www.microsoft.com/en-us/Licensing/product-licensing/products.aspx) for details. Microsoft offers policy controls that may be used to disable new Cognitive Services deployments (https://docs.microsoft.com/en-us/azure/cognitive-services/cognitive-services-apis-create-account). From f434cfb0f01ecad557e0f887c7bbb8a9ecf9c710 Mon Sep 17 00:00:00 2001 From: Yang Yuan Date: Mon, 10 Aug 2020 00:30:49 -0700 Subject: [PATCH 2/3] Update changelog --- src/CognitiveServices/CognitiveServices/ChangeLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CognitiveServices/CognitiveServices/ChangeLog.md b/src/CognitiveServices/CognitiveServices/ChangeLog.md index 8ebd3d1f9a91..4832ab456737 100644 --- a/src/CognitiveServices/CognitiveServices/ChangeLog.md +++ b/src/CognitiveServices/CognitiveServices/ChangeLog.md @@ -18,6 +18,7 @@ - Additional information about change #1 --> ## Upcoming Release +* Show additional legal terms for certain APIs. ## Version 1.5.1 * Used `Deny` specifically as NetworkRules default action. From e697c5fb9a69a34734665a76a33aafd2e2794b4e Mon Sep 17 00:00:00 2001 From: Yang Yuan Date: Mon, 24 Aug 2020 22:43:54 -0700 Subject: [PATCH 3/3] Add "CognitiveServices" too --- .../NewAzureCognitiveServicesAccount.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CognitiveServices/CognitiveServices/CognitiveServicesAccount/NewAzureCognitiveServicesAccount.cs b/src/CognitiveServices/CognitiveServices/CognitiveServicesAccount/NewAzureCognitiveServicesAccount.cs index 452fc7c975ae..74a32e921239 100644 --- a/src/CognitiveServices/CognitiveServices/CognitiveServicesAccount/NewAzureCognitiveServicesAccount.cs +++ b/src/CognitiveServices/CognitiveServices/CognitiveServicesAccount/NewAzureCognitiveServicesAccount.cs @@ -246,7 +246,7 @@ public override void ExecuteCmdlet() } } - if (Type.Equals("Face", StringComparison.InvariantCultureIgnoreCase)) + if (Type.Equals("Face", StringComparison.InvariantCultureIgnoreCase) || Type.Equals("CognitiveServices", StringComparison.InvariantCultureIgnoreCase)) { if (Force.IsPresent) {