Skip to content

Conversation

@adeal
Copy link
Contributor

@adeal adeal commented Jan 26, 2019

Description

Current behavior of SQL cmdlets inheriting from AzureSqlCmdletBase results in the user getting a nullref exception when using a command prior to logging into their AzAccount. This is caused by the existing code unconditionally accessing DefaultProfile.DefaultContext.Subscription, which only gets set upon login.

This change fixes this behavior by:

  1. Change the signature of AzureSqlCmdletBase.InitModelAdapter() to no longer have a IAzureSubscription parameter
  2. Conditionally access IAzureContext.Subscription

Existing behavior:
before

New behavior:
after

Checklist

Copy link
Contributor

@jaredmoo jaredmoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@vladimir-shcherbakov
Copy link
Contributor

@cormacpayne cormacpayne merged commit ddf937f into Azure:master Jan 29, 2019
@adeal adeal deleted the SqlFixNullRef branch January 29, 2019 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants