Skip to content

Commit 3eb2516

Browse files
committed
Fixing Set-AzureSqlDatabase when targetting a v11 server through the ARM endpoint.
1 parent ef4fb6f commit 3eb2516

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/ResourceManager/Sql/Commands.Sql/Database/Cmdlet/SetAzureSqlDatabase.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using System;
1516
using System.Collections.Generic;
1617
using System.Linq;
1718
using System.Management.Automation;
@@ -116,8 +117,21 @@ protected override IEnumerable<AzureSqlDatabaseModel> ApplyUserInputToModel(IEnu
116117
/// <returns>The input entity</returns>
117118
protected override IEnumerable<AzureSqlDatabaseModel> PersistChanges(IEnumerable<AzureSqlDatabaseModel> entity)
118119
{
120+
AzureSqlDatabaseModel response = null;
121+
try
122+
{
123+
response = ModelAdapter.UpsertDatabase(this.ResourceGroupName, this.ServerName, entity.First());
124+
}
125+
catch(ArgumentNullException ex)
126+
{
127+
if(ex.ParamName == "operationStatusLink")
128+
{
129+
response = ModelAdapter.GetDatabase(this.ResourceGroupName, this.ServerName, entity.First().DatabaseName);
130+
}
131+
}
132+
119133
return new List<AzureSqlDatabaseModel>() {
120-
ModelAdapter.UpsertDatabase(this.ResourceGroupName, this.ServerName, entity.First())
134+
response
121135
};
122136
}
123137
}

0 commit comments

Comments
 (0)