Skip to content

Commit ddf937f

Browse files
authored
Merge pull request Azure#8411 from dealaus/SqlFixNullRef
[SQL] Fix null ref when not logged into Azure account for all sql cmdlets
2 parents 201df91 + b954222 commit ddf937f

File tree

129 files changed

+157
-288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+157
-288
lines changed

src/Sql/Sql/AdvancedThreatProtection/Cmdlet/SqlManagedInstanceAdvancedDataSecurityCmdletBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected override ManagedInstanceAdvancedDataSecurityPolicyModel GetEntity()
7474
/// </summary>
7575
/// <param name="subscription">The AzureSubscription in which the current execution is performed</param>
7676
/// <returns>An initialized and ready to use ModelAdapter object</returns>
77-
protected override SqlAdvancedThreatProtectionAdapter InitModelAdapter(IAzureSubscription subscription)
77+
protected override SqlAdvancedThreatProtectionAdapter InitModelAdapter()
7878
{
7979
return new SqlAdvancedThreatProtectionAdapter(DefaultProfile.DefaultContext);
8080
}

src/Sql/Sql/AdvancedThreatProtection/Cmdlet/SqlServerAdvancedThreatProtectionCmdletBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ protected override ServerAdvancedThreatProtectionPolicyModel GetEntity()
7575
/// <summary>
7676
/// Creation and initialization of the ModelAdapter object
7777
/// </summary>
78-
/// <param name="subscription">The AzureSubscription in which the current execution is performed</param>
7978
/// <returns>An initialized and ready to use ModelAdapter object</returns>
80-
protected override SqlAdvancedThreatProtectionAdapter InitModelAdapter(IAzureSubscription subscription)
79+
protected override SqlAdvancedThreatProtectionAdapter InitModelAdapter()
8180
{
8281
return new SqlAdvancedThreatProtectionAdapter(DefaultProfile.DefaultContext);
8382
}

src/Sql/Sql/AdvancedThreatProtection/Services/SqlAdvancedThreatProtectionAdapter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class SqlAdvancedThreatProtectionAdapter
4848
public SqlAdvancedThreatProtectionAdapter(IAzureContext context)
4949
{
5050
Context = context;
51-
Subscription = context.Subscription;
51+
Subscription = context?.Subscription;
5252
SqlThreatDetectionAdapter = new SqlThreatDetectionAdapter(Context);
5353
}
5454

src/Sql/Sql/Advisor/Cmdlet/AzureSqlDatabaseAdvisorCmdletBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ public abstract class AzureSqlDatabaseAdvisorCmdletBase : AzureSqlCmdletBase<IEn
5151
/// <summary>
5252
/// Initializes the model adapter
5353
/// </summary>
54-
/// <param name="subscription">The subscription the cmdlets are operation under</param>
5554
/// <returns>The advisor adapter</returns>
56-
protected override AzureSqlDatabaseAdvisorAdapter InitModelAdapter(IAzureSubscription subscription)
55+
protected override AzureSqlDatabaseAdvisorAdapter InitModelAdapter()
5756
{
5857
return new AzureSqlDatabaseAdvisorAdapter(DefaultProfile.DefaultContext);
5958
}

src/Sql/Sql/Advisor/Cmdlet/AzureSqlElasticPoolAdvisorCmdletBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ public abstract class AzureSqlElasticPoolAdvisorCmdletBase : AzureSqlCmdletBase<
5151
/// <summary>
5252
/// Initializes the model adapter
5353
/// </summary>
54-
/// <param name="subscription">The subscription the cmdlets are operation under</param>
5554
/// <returns>The advisor adapter</returns>
56-
protected override AzureSqlElasticPoolAdvisorAdapter InitModelAdapter(IAzureSubscription subscription)
55+
protected override AzureSqlElasticPoolAdvisorAdapter InitModelAdapter()
5756
{
5857
return new AzureSqlElasticPoolAdvisorAdapter(DefaultProfile.DefaultContext);
5958
}

src/Sql/Sql/Advisor/Cmdlet/AzureSqlServerAdvisorCmdletBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ public abstract class AzureSqlServerAdvisorCmdletBase : AzureSqlCmdletBase<IEnum
4141
/// <summary>
4242
/// Initializes the model adapter
4343
/// </summary>
44-
/// <param name="subscription">The subscription the cmdlets are operation under</param>
4544
/// <returns>The advisor adapter</returns>
46-
protected override AzureSqlServerAdvisorAdapter InitModelAdapter(IAzureSubscription subscription)
45+
protected override AzureSqlServerAdvisorAdapter InitModelAdapter()
4746
{
4847
return new AzureSqlServerAdvisorAdapter(DefaultProfile.DefaultContext);
4948
}

src/Sql/Sql/Advisor/Service/AzureSqlAdvisorCommunicatorBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ public class AzureSqlAdvisorCommunicatorBase
5151
public AzureSqlAdvisorCommunicatorBase(IAzureContext context)
5252
{
5353
Context = context;
54-
if (context.Subscription != Subscription)
54+
if (context?.Subscription != Subscription)
5555
{
56-
Subscription = context.Subscription;
56+
Subscription = context?.Subscription;
5757
SqlClient = null;
5858
}
5959
}

src/Sql/Sql/Auditing/Cmdlet/AuditingSettings/SqlDatabaseAuditingSettingsCmdletBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ protected override DatabaseBlobAuditingSettingsModel GetEntity()
4242
/// <summary>
4343
/// Creation and initialization of the ModelAdapter object
4444
/// </summary>
45-
/// <param name="subscription">The AzureSubscription in which the current execution is performed</param>
4645
/// <returns>An initialized and ready to use ModelAdapter object</returns>
47-
protected override SqlAuditAdapter InitModelAdapter(IAzureSubscription subscription)
46+
protected override SqlAuditAdapter InitModelAdapter()
4847
{
4948
return new SqlAuditAdapter(DefaultProfile.DefaultContext);
5049
}

src/Sql/Sql/Auditing/Cmdlet/AuditingSettings/SqlServerAuditingSettingsCmdletBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ protected override ServerBlobAuditingSettingsModel GetEntity()
5252
/// <summary>
5353
/// Creation and initialization of the ModelAdapter object
5454
/// </summary>
55-
/// <param name="subscription">The AzureSubscription in which the current execution is performed</param>
5655
/// <returns>An initialized and ready to use ModelAdapter object</returns>
57-
protected override SqlAuditAdapter InitModelAdapter(IAzureSubscription subscription)
56+
protected override SqlAuditAdapter InitModelAdapter()
5857
{
5958
return new SqlAuditAdapter(DefaultProfile.DefaultContext);
6059
}

src/Sql/Sql/Auditing/Cmdlet/SqlDatabaseAuditingCmdletBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,8 @@ protected override AuditingPolicyModel GetEntity()
5959
/// <summary>
6060
/// Creation and initialization of the ModelAdapter object
6161
/// </summary>
62-
/// <param name="subscription">The AzureSubscription in which the current execution is performed</param>
6362
/// <returns>An initialized and ready to use ModelAdapter object</returns>
64-
protected override SqlAuditAdapter InitModelAdapter(IAzureSubscription subscription)
63+
protected override SqlAuditAdapter InitModelAdapter()
6564
{
6665
return new SqlAuditAdapter(DefaultProfile.DefaultContext);
6766
}

src/Sql/Sql/Auditing/Cmdlet/SqlDatabaseServerAuditingCmdletBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ protected override AuditingPolicyModel GetEntity()
6767
/// <summary>
6868
/// Creation and initialization of the ModelAdapter object
6969
/// </summary>
70-
/// <param name="subscription">The AzureSubscription in which the current execution is performed</param>
7170
/// <returns>An initialized and ready to use ModelAdapter object</returns>
72-
protected override SqlAuditAdapter InitModelAdapter(IAzureSubscription subscription)
71+
protected override SqlAuditAdapter InitModelAdapter()
7372
{
7473
return new SqlAuditAdapter(DefaultProfile.DefaultContext);
7574
}

src/Sql/Sql/Auditing/Services/AuditingEndpointsCommunicator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ public class AuditingEndpointsCommunicator
4949
public AuditingEndpointsCommunicator(IAzureContext context)
5050
{
5151
Context = context;
52-
if (context.Subscription != Subscription)
52+
if (context?.Subscription != Subscription)
5353
{
54-
Subscription = context.Subscription;
54+
Subscription = context?.Subscription;
5555
LegacySqlClient = null;
5656
SqlClient = null;
5757
}

src/Sql/Sql/Auditing/Services/SqlAuditAdapter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public class SqlAuditAdapter
7979
public SqlAuditAdapter(IAzureContext context)
8080
{
8181
Context = context;
82-
Subscription = context.Subscription;
82+
Subscription = context?.Subscription;
8383
Communicator = new AuditingEndpointsCommunicator(Context);
8484
AzureCommunicator = new AzureEndpointsCommunicator(Context);
8585
IgnoreStorage = false;

src/Sql/Sql/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020
## Upcoming Release
2121
* Add Get/Set AzSqlDatabaseBackupShortTermRetentionPolicy
22+
* Fix issue where not being logged into Azure account would result in nullref exception when executing SQL cmdlets
2223

2324
## Version 1.1.0
2425
* Update incorrect online help URLs

src/Sql/Sql/Common/AzureEndpointsCommunicator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ public class AzureEndpointsCommunicator
6060
public AzureEndpointsCommunicator(IAzureContext context)
6161
{
6262
Context = context;
63-
if (context.Subscription != Subscription)
63+
if (context?.Subscription != Subscription)
6464
{
65-
Subscription = context.Subscription;
65+
Subscription = context?.Subscription;
6666
ResourcesClient = null;
6767
StorageV2Client = null;
6868
}

src/Sql/Sql/Common/AzureSqlCmdletBase.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,8 @@ protected virtual string GetResourceId(M model)
9595
/// <summary>
9696
/// Creation and initialization of the ModelAdapter object
9797
/// </summary>
98-
/// <param name="subscription">The AzureSubscription in which the current execution is performed</param>
9998
/// <returns>An initialized and ready to use ModelAdapter object</returns>
100-
protected abstract A InitModelAdapter(IAzureSubscription subscription);
99+
protected abstract A InitModelAdapter();
101100

102101
/// <summary>
103102
/// Transforms the given model object to be an object that is written out
@@ -119,7 +118,7 @@ protected virtual string GetConfirmActionProcessMessage()
119118
/// </summary>
120119
public override void ExecuteCmdlet()
121120
{
122-
ModelAdapter = InitModelAdapter(DefaultProfile.DefaultContext.Subscription);
121+
ModelAdapter = InitModelAdapter();
123122
M model = GetEntity();
124123
M updatedModel = ApplyUserInputToModel(model);
125124
M responseModel = default(M);

src/Sql/Sql/Data Masking/Cmdlet/SqlDatabaseDataMaskingPolicyCmdletBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ protected override DatabaseDataMaskingPolicyModel GetEntity()
3737
/// <summary>
3838
/// Creation and initialization of the ModelAdapter object
3939
/// </summary>
40-
/// <param name="subscription">The AzureSubscription in which the current execution is performed</param>
4140
/// <returns>An initialized and ready to use ModelAdapter object</returns>
42-
protected override SqlDataMaskingAdapter InitModelAdapter(IAzureSubscription subscription)
41+
protected override SqlDataMaskingAdapter InitModelAdapter()
4342
{
4443
return new SqlDataMaskingAdapter(DefaultProfile.DefaultContext);
4544
}

src/Sql/Sql/Data Masking/Cmdlet/SqlDatabaseDataMaskingRuleCmdletBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,8 @@ protected override IEnumerable<DatabaseDataMaskingRuleModel> PersistChanges(IEnu
8989
/// <summary>
9090
/// Creation and initialization of the ModelAdapter object
9191
/// </summary>
92-
/// <param name="subscription">The AzureSubscription in which the current execution is performed</param>
9392
/// <returns>An initialized and ready to use ModelAdapter object</returns>
94-
protected override SqlDataMaskingAdapter InitModelAdapter(IAzureSubscription subscription)
93+
protected override SqlDataMaskingAdapter InitModelAdapter()
9594
{
9695
return new SqlDataMaskingAdapter(DefaultProfile.DefaultContext);
9796
}

src/Sql/Sql/Data Masking/Services/DataMaskingEndpointsCommunicator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ public class DataMaskingEndpointsCommunicator
4545
public DataMaskingEndpointsCommunicator(IAzureContext context)
4646
{
4747
Context = context;
48-
if (context.Subscription != Subscription)
48+
if (context?.Subscription != Subscription)
4949
{
50-
Subscription = context.Subscription;
50+
Subscription = context?.Subscription;
5151
SqlClient = null;
5252
}
5353
}

src/Sql/Sql/Data Masking/Services/SqlDataMaskingAdapter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class SqlDataMaskingAdapter
4848
public SqlDataMaskingAdapter(IAzureContext context)
4949
{
5050
Context = context;
51-
Subscription = context.Subscription;
51+
Subscription = context?.Subscription;
5252
Communicator = new DataMaskingEndpointsCommunicator(Context);
5353
}
5454

src/Sql/Sql/Data Sync/Cmdlet/AzureSqlSyncAgentCmdletBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ public abstract class AzureSqlSyncAgentCmdletBase : AzureSqlCmdletBase<IEnumerab
4242
/// <summary>
4343
/// Creation and initialization of the ModelAdapter object
4444
/// </summary>
45-
/// <param name="subscription">The Azure Subscription in which the current execution is performed</param>
4645
/// <returns>An initialized and ready to use ModelAdapter object</returns>
47-
protected override AzureSqlDataSyncAdapter InitModelAdapter(IAzureSubscription subscription)
46+
protected override AzureSqlDataSyncAdapter InitModelAdapter()
4847
{
4948
return new AzureSqlDataSyncAdapter(DefaultProfile.DefaultContext);
5049
}

src/Sql/Sql/Data Sync/Cmdlet/AzureSqlSyncGroupCmdletBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ public abstract class AzureSqlSyncGroupCmdletBase : AzureSqlDatabaseCmdletBase<I
3434
/// <summary>
3535
/// Creation and initialization of the ModelAdapter object
3636
/// </summary>
37-
/// <param name="subscription">The Azure Subscription in which the current execution is performed</param>
3837
/// <returns>An initialized and ready to use ModelAdapter object</returns>
39-
protected override AzureSqlDataSyncAdapter InitModelAdapter(IAzureSubscription subscription)
38+
protected override AzureSqlDataSyncAdapter InitModelAdapter()
4039
{
4140
return new AzureSqlDataSyncAdapter(DefaultProfile.DefaultContext);
4241
}

src/Sql/Sql/Data Sync/Cmdlet/AzureSqlSyncMemberCmdletBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ public abstract class AzureSqlSyncMemberCmdletBase : AzureSqlDatabaseCmdletBase<
3939
/// <summary>
4040
/// Creation and initialization of the ModelAdapter object
4141
/// </summary>
42-
/// <param name="subscription">The Azure Subscription in which the current execution is performed</param>
4342
/// <returns>An initialized and ready to use ModelAdapter object</returns>
44-
protected override AzureSqlDataSyncAdapter InitModelAdapter(IAzureSubscription subscription)
43+
protected override AzureSqlDataSyncAdapter InitModelAdapter()
4544
{
4645
return new AzureSqlDataSyncAdapter(DefaultProfile.DefaultContext);
4746
}

src/Sql/Sql/Data Sync/Cmdlet/AzureSqlSyncSchemaCmdletBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ public abstract class AzureSqlSyncSchemaCmdletBase : AzureSqlDatabaseCmdletBase<
4545
/// <summary>
4646
/// Creation and initialization of the ModelAdapter object
4747
/// </summary>
48-
/// <param name="subscription">The Azure Subscription in which the current execution is performed</param>
4948
/// <returns>An initialized and ready to use ModelAdapter object</returns>
50-
protected override AzureSqlDataSyncAdapter InitModelAdapter(IAzureSubscription subscription)
49+
protected override AzureSqlDataSyncAdapter InitModelAdapter()
5150
{
5251
return new AzureSqlDataSyncAdapter(DefaultProfile.DefaultContext);
5352
}

src/Sql/Sql/Data Sync/Cmdlet/GetAzureSqlSyncAgentLinkedDatabase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ public class GetAzureSqlSyncAgentSqlServerDatabase : AzureSqlCmdletBase<IEnumera
5353
/// <summary>
5454
/// Creation and initialization of the ModelAdapter object
5555
/// </summary>
56-
/// <param name="subscription">The AzureSubscription in which the current execution is performed</param>
5756
/// <returns>An initialized and ready to use ModelAdapter object</returns>
58-
protected override AzureSqlDataSyncAdapter InitModelAdapter(IAzureSubscription subscription)
57+
protected override AzureSqlDataSyncAdapter InitModelAdapter()
5958
{
6059
return new AzureSqlDataSyncAdapter(DefaultProfile.DefaultContext);
6160
}

src/Sql/Sql/Data Sync/Cmdlet/GetAzureSqlSyncGroupLog.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ public class GetAzureSqlSyncGroupLog : AzureSqlDatabaseCmdletBase<IEnumerable<Az
6464
/// <summary>
6565
/// Creation and initialization of the ModelAdapter object
6666
/// </summary>
67-
/// <param name="subscription">The Azure Subscription in which the current execution is performed</param>
6867
/// <returns>An initialized and ready to use ModelAdapter object</returns>
69-
protected override AzureSqlDataSyncAdapter InitModelAdapter(IAzureSubscription subscription)
68+
protected override AzureSqlDataSyncAdapter InitModelAdapter()
7069
{
7170
return new AzureSqlDataSyncAdapter(DefaultProfile.DefaultContext);
7271
}

src/Sql/Sql/Data Sync/Cmdlet/NewAzureSqlSyncAgentKey.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ public class NewAzureSqlSyncAgentKey : AzureSqlCmdletBase<IEnumerable<AzureSqlSy
5454
/// <summary>
5555
/// Creation and initialization of the ModelAdapter object
5656
/// </summary>
57-
/// <param name="subscription">The AzureSubscription in which the current execution is performed</param>
5857
/// <returns>An initialized and ready to use ModelAdapter object</returns>
59-
protected override AzureSqlDataSyncAdapter InitModelAdapter(IAzureSubscription subscription)
58+
protected override AzureSqlDataSyncAdapter InitModelAdapter()
6059
{
6160
return new AzureSqlDataSyncAdapter(DefaultProfile.DefaultContext);
6261
}

src/Sql/Sql/Data Sync/Services/AzureSqlDataSyncAdapter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class AzureSqlDataSyncAdapter
5555
public AzureSqlDataSyncAdapter(IAzureContext context)
5656
{
5757
Context = context;
58-
_subscription = context.Subscription;
58+
_subscription = context?.Subscription;
5959
Communicator = new AzureSqlDataSyncCommunicator(Context);
6060
}
6161

src/Sql/Sql/Data Sync/Services/AzureSqlDataSyncCommunicator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public class AzureSqlDataSyncCommunicator
4848
public AzureSqlDataSyncCommunicator(IAzureContext context)
4949
{
5050
Context = context;
51-
if (context.Subscription != Subscription)
51+
if (context?.Subscription != Subscription)
5252
{
53-
Subscription = context.Subscription;
53+
Subscription = context?.Subscription;
5454
LegacySqlClient = null;
5555
}
5656
}

src/Sql/Sql/Database Activation/Cmdlet/AzureSqlDatabaseActivationCmdletBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@ public abstract class AzureSqlDatabaseActivationCmdletBase
5656
/// <summary>
5757
/// Initializes the adapter
5858
/// </summary>
59-
/// <param name="subscription"></param>
6059
/// <returns></returns>
61-
protected override AzureSqlDatabaseActivationAdapter InitModelAdapter(IAzureSubscription subscription)
60+
protected override AzureSqlDatabaseActivationAdapter InitModelAdapter()
6261
{
6362
return new AzureSqlDatabaseActivationAdapter(DefaultProfile.DefaultContext);
6463
}

src/Sql/Sql/Database Activation/Services/SqlAzureDatabaseActivationAdapter.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ public class AzureSqlDatabaseActivationAdapter
3535
/// </summary>
3636
public IAzureContext Context { get; set; }
3737

38-
/// <summary>
39-
/// Gets or sets the Azure Subscription
40-
/// </summary>
41-
private IAzureSubscription _subscription { get; set; }
42-
4338
/// <summary>
4439
/// Constructs a database activation adapter
4540
/// </summary>
@@ -48,7 +43,6 @@ public class AzureSqlDatabaseActivationAdapter
4843
public AzureSqlDatabaseActivationAdapter(IAzureContext context)
4944
{
5045
Context = context;
51-
_subscription = context.Subscription;
5246
Communicator = new AzureSqlDatabaseActivationCommunicator(Context);
5347
}
5448

src/Sql/Sql/Database Activation/Services/SqlAzureDatabaseActivationCommunicator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public class AzureSqlDatabaseActivationCommunicator
4848
public AzureSqlDatabaseActivationCommunicator(IAzureContext context)
4949
{
5050
Context = context;
51-
if (context.Subscription != Subscription)
51+
if (context?.Subscription != Subscription)
5252
{
53-
Subscription = context.Subscription;
53+
Subscription = context?.Subscription;
5454
SqlClient = null;
5555
}
5656
}

src/Sql/Sql/Database Backup/Cmdlet/AzureSqlDatabaseBackupLongTermRetentionPolicyCmdletBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ public abstract class AzureSqlDatabaseBackupLongTermRetentionPolicyCmdletBase :
5353
/// <summary>
5454
/// Initializes the adapter
5555
/// </summary>
56-
/// <param name="subscription">The subscription to operate on</param>
5756
/// <returns></returns>
58-
protected override AzureSqlDatabaseBackupAdapter InitModelAdapter(IAzureSubscription subscription)
57+
protected override AzureSqlDatabaseBackupAdapter InitModelAdapter()
5958
{
6059
return new AzureSqlDatabaseBackupAdapter(DefaultProfile.DefaultContext);
6160
}

src/Sql/Sql/Database Backup/Cmdlet/AzureSqlDatabaseBackupShortTermRetentionPolicyCmdletBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,8 @@ public abstract class AzureSqlDatabaseBackupShortTermRetentionPolicyCmdletBase :
108108
/// <summary>
109109
/// Initializes the adapter
110110
/// </summary>
111-
/// <param name="subscription">The subscription to operate on</param>
112111
/// <returns></returns>
113-
protected override AzureSqlDatabaseBackupAdapter InitModelAdapter(IAzureSubscription subscription)
112+
protected override AzureSqlDatabaseBackupAdapter InitModelAdapter()
114113
{
115114
return new AzureSqlDatabaseBackupAdapter(DefaultProfile.DefaultContext);
116115
}

0 commit comments

Comments
 (0)