Skip to content

Commit 2898c3c

Browse files
authored
Merge pull request #3964 from felixwa/Show-Creation-Notice
Display notice text when create a Cognitive Services account
2 parents 6019072 + a08f043 commit 2898c3c

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

src/ResourceManager/CognitiveServices/Commands.Management.CognitiveServices/CognitiveServicesAccount/NewAzureCognitiveServicesAccount.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ public class NewAzureCognitiveServicesAccountCommand : CognitiveServicesAccountB
7373
[Parameter(
7474
Mandatory = false,
7575
HelpMessage = "Cognitive Services Account Tags.")]
76-
[Alias (TagsAlias)]
76+
[Alias(TagsAlias)]
7777
[ValidateNotNull]
7878
[AllowEmptyCollection]
7979
public Hashtable[] Tag { get; set; }
80-
80+
8181
[Parameter(Mandatory = false, HelpMessage = "Don't ask for confirmation.")]
8282
public SwitchParameter Force { get; set; }
83-
83+
8484
public override void ExecuteCmdlet()
8585
{
8686
base.ExecuteCmdlet();
@@ -97,10 +97,20 @@ public override void ExecuteCmdlet()
9797
};
9898

9999
if (ShouldProcess(
100-
this.Name, string.Format(CultureInfo.CurrentCulture, Resources.NewAccount_ProcessMessage, this.Name, this.Type, this.SkuName, this.Location))
101-
||
102-
Force.IsPresent)
100+
this.Name, string.Format(CultureInfo.CurrentCulture, Resources.NewAccount_ProcessMessage, this.Name, this.Type, this.SkuName, this.Location)))
103101
{
102+
if (Force.IsPresent)
103+
{
104+
WriteWarning(Resources.NewAccount_Notice);
105+
}
106+
else
107+
{
108+
bool yesToAll = false, noToAll = false;
109+
if (!ShouldContinue(Resources.NewAccount_Notice, "Notice", true, ref yesToAll, ref noToAll))
110+
{
111+
return;
112+
}
113+
}
104114

105115
var createAccountResponse = this.CognitiveServicesClient.CognitiveServicesAccounts.Create(
106116
this.ResourceGroupName,

src/ResourceManager/CognitiveServices/Commands.Management.CognitiveServices/Properties/Resources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ResourceManager/CognitiveServices/Commands.Management.CognitiveServices/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@
120120
<data name="NewAccountKey_ProcessMessage" xml:space="preserve">
121121
<value>Regenerating Key {0} for account {1}.</value>
122122
</data>
123+
<data name="NewAccount_Notice" xml:space="preserve">
124+
<value>Microsoft will use data you send to the Cognitive Services to improve Microsoft products and services. Where you send personal data to the 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 the 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).</value>
125+
</data>
123126
<data name="NewAccount_ProcessMessage" xml:space="preserve">
124127
<value>Creating new Cognitive Services account {0} of type {1}, Sku {2} at location {3}.</value>
125128
</data>

0 commit comments

Comments
 (0)