Skip to content

Commit 730ce62

Browse files
committed
Changing threat detection policy "without a storage account name" error
Changing threat detection policy "without a storage account name" error
1 parent f114c28 commit 730ce62

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/ResourceManager/Sql/Commands.Sql/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@
174174
<data name="NoStorageAccountWhenConfiguringAuditingPolicy" xml:space="preserve">
175175
<value>Cannot set auditing policy without a storage account name.</value>
176176
</data>
177+
<data name="NoStorageAccountWhenConfiguringThreatDetectionPolicy" xml:space="preserve">
178+
<value>Cannot set threat detection policy without a storage account name.</value>
179+
</data>
177180
<data name="PdoTitle" xml:space="preserve">
178181
<value>PHP Data Objects(PDO) Sample Code:</value>
179182
</data>

src/ResourceManager/Sql/Commands.Sql/ThreatDetection/Services/SqlThreatDetectionAdapter.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,11 @@ private BaseSecurityAlertPolicyProperties PopulatePolicyProperties(BaseThreatDet
265265

266266
private void PopulateStoragePropertiesInPolicy(BaseThreatDetectionPolicyModel model, BaseSecurityAlertPolicyProperties properties, string storageEndpointSuffix)
267267
{
268+
if (string.IsNullOrEmpty(model.StorageAccountName)) // can happen if the user didn't provide account name for a policy that lacked it
269+
{
270+
throw new Exception(string.Format(Properties.Resources.NoStorageAccountWhenConfiguringThreatDetectionPolicy));
271+
}
272+
268273
properties.StorageEndpoint = string.Format("https://{0}.blob.{1}", model.StorageAccountName, storageEndpointSuffix);
269274
properties.StorageAccountAccessKey = AzureCommunicator.GetStorageKeys(model.StorageAccountName)[StorageKeyKind.Primary];
270275
}

0 commit comments

Comments
 (0)