Skip to content

Commit b8c48f7

Browse files
sriramvushahabhijeet
authored andcommitted
Validating vault settings / context (Azure#3360)
Fix for the issue#3331. Checking vault context parameters before creating client to perform actual operation.
1 parent 52ee3a4 commit b8c48f7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Common/PSSiteRecoveryClient.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,12 @@ public CustomRequestHeaders GetRequestHeaders(bool shouldSignRequest = true)
312312
/// <returns>Site Recovery Management client</returns>
313313
private SiteRecoveryManagementClient GetSiteRecoveryClient()
314314
{
315+
if (string.IsNullOrEmpty(asrVaultCreds.ResourceName) ||
316+
string.IsNullOrEmpty(asrVaultCreds.ResourceGroupName))
317+
{
318+
throw new InvalidOperationException(Properties.Resources.MissingVaultSettings);
319+
}
320+
315321
SiteRecoveryManagementClient siteRecoveryClient =
316322
AzureSession.ClientFactory.CreateCustomClient<SiteRecoveryManagementClient>(
317323
asrVaultCreds.ResourceName,
@@ -426,4 +432,4 @@ public static T Deserialize(string xmlString)
426432
return propertyBagContainer;
427433
}
428434
}
429-
}
435+
}

0 commit comments

Comments
 (0)