24
24
using System . Text ;
25
25
using System . Globalization ;
26
26
using Microsoft . Azure . Management . RecoveryServices . Models ;
27
+ using Microsoft . Azure . Commands . RecoveryServices . Properties ;
27
28
28
29
namespace Microsoft . Azure . Commands . RecoveryServices
29
30
{
@@ -196,14 +197,14 @@ public void GetAzureRMRecoveryServicesVaultBackupCredentials()
196
197
string targetLocation = string . IsNullOrEmpty ( this . Path ) ? Utilities . GetDefaultPath ( ) : this . Path ;
197
198
if ( ! Directory . Exists ( targetLocation ) )
198
199
{
199
- throw new ArgumentException ( "The target location provided is not a directory. Please provide a directory." ) ;
200
+ throw new ArgumentException ( Resources . VaultCredPathException ) ;
200
201
}
201
202
202
203
string subscriptionId = DefaultContext . Subscription . Id . ToString ( ) ;
203
204
string displayName = this . Vault . Name ;
204
205
205
206
WriteDebug ( string . Format ( CultureInfo . InvariantCulture ,
206
- "Executing cmdlet with SubscriptionId = {0}, ResourceGroupName = {1}, ResourceName = {2}, TargetLocation = {3}" ,
207
+ Resources . ExecutingGetVaultCredCmdlet ,
207
208
subscriptionId , this . Vault . ResouceGroupName , this . Vault . Name , targetLocation ) ) ;
208
209
209
210
// Generate certificate
@@ -214,9 +215,9 @@ public void GetAzureRMRecoveryServicesVaultBackupCredentials()
214
215
try
215
216
{
216
217
// Upload cert into ID Mgmt
217
- WriteDebug ( string . Format ( CultureInfo . InvariantCulture , "RecoveryService - Going to upload the certificate" ) ) ;
218
+ WriteDebug ( string . Format ( CultureInfo . InvariantCulture , Resources . UploadingCertToIdmgmt ) ) ;
218
219
acsNamespace = UploadCert ( cert ) ;
219
- WriteDebug ( string . Format ( CultureInfo . InvariantCulture , "RecoveryService - Successfully uploaded the certificate" ) ) ;
220
+ WriteDebug ( string . Format ( CultureInfo . InvariantCulture , Resources . UploadedCertToIdmgmt ) ) ;
220
221
}
221
222
catch ( Exception exception )
222
223
{
@@ -235,7 +236,7 @@ public void GetAzureRMRecoveryServicesVaultBackupCredentials()
235
236
// prepare for download
236
237
string fileName = string . Format ( "{0}_{1:ddd MMM dd yyyy}.VaultCredentials" , displayName , DateTime . UtcNow ) ;
237
238
string filePath = System . IO . Path . Combine ( targetLocation , fileName ) ;
238
- WriteDebug ( string . Format ( "Saving Vault Credentials to file : {0}" , filePath ) ) ;
239
+ WriteDebug ( string . Format ( Resources . SavingVaultCred , filePath ) ) ;
239
240
240
241
File . WriteAllBytes ( filePath , Encoding . UTF8 . GetBytes ( vaultCredsFileContent ) ) ;
241
242
@@ -301,7 +302,7 @@ private string GenerateVaultCredsForBackup(X509Certificate2 cert, string subscri
301
302
DataContractSerializer serializer = new DataContractSerializer ( typeof ( BackupVaultCreds ) ) ;
302
303
serializer . WriteObject ( writer , backupVaultCreds ) ;
303
304
304
- WriteDebug ( string . Format ( CultureInfo . InvariantCulture , "RecoveryService - Backup Vault - Successfully serialized the file content" ) ) ;
305
+ WriteDebug ( string . Format ( CultureInfo . InvariantCulture , Resources . BackupVaultSerialized ) ) ;
305
306
}
306
307
307
308
return Encoding . UTF8 . GetString ( output . ToArray ( ) ) ;
0 commit comments