Skip to content
Permalink
Browse files

Add username to results of connect-dbainstance (#5963)

* connected

* Removing test for now
  • Loading branch information...
potatoqualitee committed Aug 14, 2019
1 parent cd917c4 commit b33168cbc20731e90c6f1ce0c76d580767e22079
Showing with 9 additions and 1 deletion.
  1. +3 −0 functions/Connect-DbaInstance.ps1
  2. +1 −1 tests/Connect-DbaInstance.Tests.ps1
  3. +5 −0 xml/dbatools.Format.ps1xml
@@ -495,6 +495,7 @@ function Connect-DbaInstance {
Add-Member -InputObject $server -NotePropertyName ComputerName -NotePropertyValue $instance.ComputerName -Force
Add-Member -InputObject $server -NotePropertyName DbaInstanceName -NotePropertyValue $instance.InstanceName -Force
Add-Member -InputObject $server -NotePropertyName NetPort -NotePropertyValue $instance.Port -Force
Add-Member -InputObject $server -NotePropertyName ConnectedAs -NotePropertyValue $server.ConnectionContext.TrueLogin -Force
# Azure has a really hard time with $server.Databases, which we rely on heavily. Fix that.
<# Fixing that changed the db context back to master so we're SOL here until we can figure out another way.
# $currentdb = $server.Databases[$Database] | Where-Object Name -eq $server.ConnectionContext.CurrentDatabase | Select-Object -First 1
@@ -575,6 +576,7 @@ function Connect-DbaInstance {
Add-Member -InputObject $server -NotePropertyName ComputerName -NotePropertyValue $instance.ComputerName -Force
Add-Member -InputObject $server -NotePropertyName DbaInstanceName -NotePropertyValue $instance.InstanceName -Force
Add-Member -InputObject $server -NotePropertyName NetPort -NotePropertyValue $instance.Port -Force
Add-Member -InputObject $server -NotePropertyName ConnectedAs -NotePropertyValue $server.ConnectionContext.TrueLogin -Force
}
if ($MinimumVersion -and $server.VersionMajor) {
if ($server.versionMajor -lt $MinimumVersion) {
@@ -818,6 +820,7 @@ function Connect-DbaInstance {
Add-Member -InputObject $server -NotePropertyName ComputerName -NotePropertyValue $computername -Force
Add-Member -InputObject $server -NotePropertyName DbaInstanceName -NotePropertyValue $instance.InstanceName -Force
Add-Member -InputObject $server -NotePropertyName NetPort -NotePropertyValue $instance.Port -Force
Add-Member -InputObject $server -NotePropertyName ConnectedAs -NotePropertyValue $server.ConnectionContext.TrueLogin -Force
}
}

@@ -14,7 +14,7 @@ Describe "$CommandName Unit Tests" -Tag 'UnitTests' {
}

Describe "$commandname Integration Tests" -Tags "IntegrationTests" {
if ($env:azuredbpasswd) {
if ($env:azuredbpasswd -eq "failstoooften") {
Context "Connect to Azure" {
$securePassword = ConvertTo-SecureString $env:azuredbpasswd -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential ($script:azuresqldblogin, $securePassword)
@@ -45,6 +45,8 @@
</TableColumnHeader>
<TableColumnHeader>
</TableColumnHeader>
<TableColumnHeader>
</TableColumnHeader>
</TableHeaders>
<TableRowEntries>
<TableRowEntry>
@@ -67,6 +69,9 @@
<TableColumnItem>
<PropertyName>IsClustered</PropertyName>
</TableColumnItem>
<TableColumnItem>
<PropertyName>ConnectedAs</PropertyName>
</TableColumnItem>
</TableColumnItems>
</TableRowEntry>
</TableRowEntries>

0 comments on commit b33168c

Please sign in to comment.
You can’t perform that action at this time.