From 4edf8479a3125a88c955f2365cdbd13c0f6e9967 Mon Sep 17 00:00:00 2001 From: j82w Date: Thu, 13 Aug 2015 13:46:32 -0700 Subject: [PATCH] Add SQL Server Active Directory administrator Cmdlets. Adding Get-AzureSqlServerActiveDirectoryAdministrator, Set-AzureSqlServerActiveDirectoryAdministrator, Remove-AzureSqlServerActiveDirectoryAdministrator. --- .../Commands.Sql.Test.csproj | 14 +- .../ServerActiveDirectoryAdministratorTest.cs | 30 + ...ServerActiveDirectoryAdministratorTest.ps1 | 73 + .../ScenarioTests/SqlEvnSetupHelper.cs | 149 ++ .../ScenarioTests/SqlTestsBase.cs | 46 +- ...erverActiveDirectoryAdministratorCRUD.json | 1936 +++++++++++++++++ .../Sql/Commands.Sql.Test/packages.config | 2 +- .../Sql/Commands.Sql/Commands.Sql.csproj | 16 +- .../Cmdlet/NewAzureSqlElasticPool.cs | 2 +- .../Cmdlet/SetAzureSqlElasticPool.cs | 2 +- .../Model/AzureSqlElasticPoolModel.cs | 2 +- .../Microsoft.Azure.Commands.Sql.dll-Help.xml | 455 ++++ .../Properties/Resources.Designer.cs | 54 + .../Commands.Sql/Properties/Resources.resx | 18 + ...rActiveDirectoryAdministratorCmdletBase.cs | 46 + ...reSqlServerActiveDirectoryAdministrator.cs | 58 + ...reSqlServerActiveDirectoryAdministrator.cs | 82 + ...reSqlServerActiveDirectoryAdministrator.cs | 107 + ...ServerActiveDirectoryAdministratorModel.cs | 45 + ...rverActiveDirectoryAdministratorAdapter.cs | 258 +++ ...ctiveDirectoryAdministratorCommunicator.cs | 123 ++ .../Sql/Commands.Sql/packages.config | 2 +- 22 files changed, 3508 insertions(+), 12 deletions(-) create mode 100644 src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/ServerActiveDirectoryAdministratorTest.cs create mode 100644 src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/ServerActiveDirectoryAdministratorTest.ps1 create mode 100644 src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlEvnSetupHelper.cs create mode 100644 src/ResourceManager/Sql/Commands.Sql.Test/SessionRecords/Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ServerActiveDirectoryAdministratorTest/TestServerActiveDirectoryAdministratorCRUD.json create mode 100644 src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/AzureSqlServerActiveDirectoryAdministratorCmdletBase.cs create mode 100644 src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/GetAzureSqlServerActiveDirectoryAdministrator.cs create mode 100644 src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/RemoveAzureSqlServerActiveDirectoryAdministrator.cs create mode 100644 src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/SetAzureSqlServerActiveDirectoryAdministrator.cs create mode 100644 src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Model/AzureSqlServerActiveDirectoryAdministratorModel.cs create mode 100644 src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Services/AzureSqlServerActiveDirectoryAdministratorAdapter.cs create mode 100644 src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Services/AzureSqlServerActiveDirectoryAdministratorCommunicator.cs diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj b/src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj index 2061bd2c3c5c..055bf27d9001 100644 --- a/src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj +++ b/src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj @@ -67,8 +67,12 @@ ..\..\..\packages\Microsoft.Azure.Gallery.2.6.2-preview\lib\net40\Microsoft.Azure.Gallery.dll + + False + ..\..\..\packages\Microsoft.Azure.Graph.RBAC.1.7.0-preview\lib\net40\Microsoft.Azure.Graph.RBAC.dll + - ..\..\..\packages\Microsoft.Azure.Management.Sql.0.32.0-prerelease\lib\net40\Microsoft.Azure.Management.Sql.dll + ..\..\..\packages\Microsoft.Azure.Management.Sql.0.36.0-prerelease\lib\net40\Microsoft.Azure.Management.Sql.dll ..\..\..\packages\Microsoft.Azure.Management.Storage.2.4.0-preview\lib\net40\Microsoft.Azure.Management.Storage.dll @@ -187,6 +191,9 @@ + + PreserveNewest + PreserveNewest @@ -202,12 +209,14 @@ Always + + @@ -424,6 +433,9 @@ Always + + Always + Always diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/ServerActiveDirectoryAdministratorTest.cs b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/ServerActiveDirectoryAdministratorTest.cs new file mode 100644 index 000000000000..486b8a4eedce --- /dev/null +++ b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/ServerActiveDirectoryAdministratorTest.cs @@ -0,0 +1,30 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.ScenarioTest.SqlTests; +using Microsoft.WindowsAzure.Commands.ScenarioTest; +using Xunit; + +namespace Microsoft.Azure.Commands.Sql.Test.ScenarioTests +{ + public class ServerActiveDirectoryAdministratorTest : SqlTestsBase + { + [Fact] + [Trait(Category.Sql, Category.CheckIn)] + public void TestServerActiveDirectoryAdministratorCRUD() + { + RunPowerShellTest("Test-ServerActiveDirectoryAdministrator"); + } + } +} diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/ServerActiveDirectoryAdministratorTest.ps1 b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/ServerActiveDirectoryAdministratorTest.ps1 new file mode 100644 index 000000000000..e5e87d34fcd1 --- /dev/null +++ b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/ServerActiveDirectoryAdministratorTest.ps1 @@ -0,0 +1,73 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# + .SYNOPSIS + Tests creating a database +#> +function Test-ServerActiveDirectoryAdministrator ($location = "North Europe") +{ + # Setup + $rg = Create-ResourceGroupForTest + $server = Create-ServerForTest $rg "12.0" $location + + try + { + $activeDirectoryGroup1 = "testAADaccount" + $activeDirectoryGroup1ObjectId = "41732a4a-e09e-4b18-9624-38e252d68bbf" + $activeDirectoryUser1 = "Test User 2" + $activeDirectoryUser1ObjectId = "e87332b2-e3ed-480a-9723-e9b3611268f8" + + # Verify there is no Active Directory Administrator set + $activeDirectoryAdmin = Get-AzureSqlServerActiveDirectoryAdministrator -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName + + Assert-Null $activeDirectoryAdmin + + # Set an Azure SQL Server Active Directory Administrator Group + $activeDirectoryAdmin1 = Set-AzureSqlServerActiveDirectoryAdministrator -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName ` + -DisplayName $activeDirectoryGroup1 + + Assert-NotNull $activeDirectoryAdmin1 + + # Verify the correct Active Directory Administrator is set + Assert-AreEqual $activeDirectoryAdmin1.DisplayName $activeDirectoryGroup1 + Assert-AreEqual $activeDirectoryAdmin1.ObjectId $activeDirectoryGroup1ObjectId + + # Get an Azure SQL Server Active Directory Administrator + $activeDirectoryAdmin2 = Get-AzureSqlServerActiveDirectoryAdministrator -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName + + Assert-AreEqual $activeDirectoryAdmin2.DisplayName $activeDirectoryGroup1 + Assert-AreEqual $activeDirectoryAdmin2.ObjectId $activeDirectoryGroup1ObjectId + + # Set an Azure SQL Server Active Directory Administrator User + $activeDirectoryAdmin3 = Set-AzureSqlServerActiveDirectoryAdministrator -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName ` + -DisplayName $activeDirectoryUser1 + + Assert-AreEqual $activeDirectoryAdmin3.DisplayName $activeDirectoryUser1 + Assert-AreEqual $activeDirectoryAdmin3.ObjectId $activeDirectoryUser1ObjectId + + # Set an Azure SQL Server Active Directory Administrator User + $activeDirectoryAdmin4 = Remove-AzureSqlServerActiveDirectoryAdministrator -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -Force + + # Verify that Azure SQL Server Active Directory Administrator was deleted + $activeDirectoryAdmin5 = Get-AzureSqlServerActiveDirectoryAdministrator -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName + + Assert-Null $activeDirectoryAdmin5 + } + finally + { + Remove-ResourceGroupForTest $rg + } +} + diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlEvnSetupHelper.cs b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlEvnSetupHelper.cs new file mode 100644 index 000000000000..0af96163993d --- /dev/null +++ b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlEvnSetupHelper.cs @@ -0,0 +1,149 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Gallery; +using Microsoft.Azure.Graph.RBAC; +using Microsoft.Azure.Management.Authorization; +using Microsoft.Azure.Management.Resources; +using Microsoft.Azure.Subscriptions; +using Microsoft.Azure.Test; +using Microsoft.Azure.Test.HttpRecorder; +using Microsoft.WindowsAzure.Commands.ScenarioTest; +using Microsoft.WindowsAzure.Commands.Utilities.Common; + +namespace Microsoft.Azure.Commands.ScenarioTest.SqlTests +{ + public class SqlEvnSetupHelper : EnvironmentSetupHelper + { + /// + /// This overrides the default subscription and default account. This allows the + /// test to get the tenant id in the test. + /// + public void SetupEnvironment() + { + base.SetupEnvironment(AzureModule.AzureResourceManager); + + TestEnvironment csmEnvironment = new CSMTestEnvironmentFactory().GetTestEnvironment(); + + if (csmEnvironment.SubscriptionId != null) + { + //Overwrite the default subscription and default account + //with ones using user ID and tenant ID from auth context + var user = GetUser(csmEnvironment); + var tenantId = GetTenantId(csmEnvironment); + + // Existing test will not have a user or tenant id set + if (tenantId != null && user != null) + { + var testSubscription = new AzureSubscription() + { + Id = new Guid(csmEnvironment.SubscriptionId), + Name = ProfileClient.Profile.DefaultSubscription.Name, + Environment = ProfileClient.Profile.DefaultSubscription.Environment, + Account = user, + Properties = new Dictionary + { + { + AzureSubscription.Property.Default, "True" + }, + { + AzureSubscription.Property.StorageAccount, + Environment.GetEnvironmentVariable("AZURE_STORAGE_ACCOUNT") + }, + { + AzureSubscription.Property.Tenants, tenantId + }, + } + }; + + var testAccount = new AzureAccount() + { + Id = user, + Type = AzureAccount.AccountType.User, + Properties = new Dictionary + { + { + AzureAccount.Property.Subscriptions, csmEnvironment.SubscriptionId + }, + } + }; + + ProfileClient.Profile.Accounts.Remove(ProfileClient.Profile.DefaultSubscription.Account); + ProfileClient.Profile.Subscriptions[testSubscription.Id] = testSubscription; + ProfileClient.Profile.Accounts[testAccount.Id] = testAccount; + ProfileClient.SetSubscriptionAsDefault(testSubscription.Name, testSubscription.Account); + + ProfileClient.Profile.Save(); + } + } + } + + /// + /// Helper function to get the tenant id if it was set in the test + /// + /// Test environment + /// The tenant id or null if not tenant id could be found. + private string GetTenantId(TestEnvironment environment) + { + if (HttpMockServer.Mode == HttpRecorderMode.Record) + { + HttpMockServer.Variables["TenantId"] = environment.AuthorizationContext.TenantId; + return environment.AuthorizationContext.TenantId; + } + else + { + if (HttpMockServer.Variables.ContainsKey("TenantId")) + { + return HttpMockServer.Variables["TenantId"]; + } + else + { + return null; + } + } + } + + /// + /// Helper function to get the user id if it was set in the test + /// + /// Test environment + /// The user id or null if not tenant id could be found. + private string GetUser(TestEnvironment environment) + { + if (HttpMockServer.Mode == HttpRecorderMode.Record) + { + HttpMockServer.Variables["User"] = environment.AuthorizationContext.UserId; + return environment.AuthorizationContext.UserId; + } + else + { + if (HttpMockServer.Variables.ContainsKey("User")) + { + return HttpMockServer.Variables["User"]; + } + else + { + return null; + } + + } + } + + } +} \ No newline at end of file diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlTestsBase.cs b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlTestsBase.cs index 3c108f01f8fa..cb8a5c912bdf 100644 --- a/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlTestsBase.cs +++ b/src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlTestsBase.cs @@ -19,18 +19,26 @@ using Microsoft.WindowsAzure.Commands.Utilities.Common; using Microsoft.WindowsAzure.Management.Storage; using Microsoft.Azure.Test; +using Microsoft.Azure.Graph.RBAC; using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Management.Authorization; +using Microsoft.Azure.Commands.Resources.Models.ActiveDirectory; +using System; namespace Microsoft.Azure.Commands.ScenarioTest.SqlTests { public class SqlTestsBase { - protected EnvironmentSetupHelper helper; + protected SqlEvnSetupHelper helper; + + private const string TenantIdKey = "TenantId"; + private const string DomainKey = "Domain"; + + public string UserDomain { get; private set; } protected SqlTestsBase() { - helper = new EnvironmentSetupHelper(); + helper = new SqlEvnSetupHelper(); } protected virtual void SetupManagementClients() @@ -39,7 +47,8 @@ protected virtual void SetupManagementClients() var storageClient = GetStorageClient(); var resourcesClient = GetResourcesClient(); var authorizationClient = GetAuthorizationManagementClient(); - helper.SetupSomeOfManagementClients(sqlCSMClient, storageClient, resourcesClient, authorizationClient); + var graphClient = GetGraphClient(); + helper.SetupSomeOfManagementClients(sqlCSMClient, storageClient, resourcesClient, authorizationClient, graphClient); } protected void RunPowerShellTest(params string[] scripts) @@ -53,7 +62,7 @@ protected void RunPowerShellTest(params string[] scripts) SetupManagementClients(); - helper.SetupEnvironment(AzureModule.AzureResourceManager); + helper.SetupEnvironment(); helper.SetupModules(AzureModule.AzureProfile, "ScenarioTests\\Common.ps1", "ScenarioTests\\" + this.GetType().Name + ".ps1"); @@ -105,5 +114,34 @@ protected AuthorizationManagementClient GetAuthorizationManagementClient() } return client; } + + protected GraphRbacManagementClient GetGraphClient() + { + var testFactory = new CSMTestEnvironmentFactory(); + var environment = testFactory.GetTestEnvironment(); + string tenantId = Guid.Empty.ToString(); + + if (HttpMockServer.Mode == HttpRecorderMode.Record) + { + tenantId = environment.AuthorizationContext.TenantId; + UserDomain = environment.AuthorizationContext.UserDomain; + + HttpMockServer.Variables[TenantIdKey] = tenantId; + HttpMockServer.Variables[DomainKey] = UserDomain; + } + else if (HttpMockServer.Mode == HttpRecorderMode.Playback) + { + if (HttpMockServer.Variables.ContainsKey(TenantIdKey)) + { + tenantId = HttpMockServer.Variables[TenantIdKey]; + } + if (HttpMockServer.Variables.ContainsKey(DomainKey)) + { + UserDomain = HttpMockServer.Variables[DomainKey]; + } + } + + return TestBase.GetGraphServiceClient(testFactory, tenantId); + } } } diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/SessionRecords/Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ServerActiveDirectoryAdministratorTest/TestServerActiveDirectoryAdministratorCRUD.json b/src/ResourceManager/Sql/Commands.Sql.Test/SessionRecords/Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ServerActiveDirectoryAdministratorTest/TestServerActiveDirectoryAdministratorCRUD.json new file mode 100644 index 000000000000..d143ed3d99ed --- /dev/null +++ b/src/ResourceManager/Sql/Commands.Sql.Test/SessionRecords/Microsoft.Azure.Commands.Sql.Test.ScenarioTests.ServerActiveDirectoryAdministratorTest/TestServerActiveDirectoryAdministratorCRUD.json @@ -0,0 +1,1936 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourcegroups/onesdk3036?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlZ3JvdXBzL29uZXNkazMwMzY/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "HEAD", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "102" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-failure-cause": [ + "gateway" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14937" + ], + "x-ms-request-id": [ + "3773c2a3-b7cb-4be2-98c4-88bb03a83705" + ], + "x-ms-correlation-request-id": [ + "3773c2a3-b7cb-4be2-98c4-88bb03a83705" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015525Z:3773c2a3-b7cb-4be2-98c4-88bb03a83705" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:55:25 GMT" + ] + }, + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourcegroups/onesdk3036?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlZ3JvdXBzL29uZXNkazMwMzY/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "HEAD", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14935" + ], + "x-ms-request-id": [ + "b65cb90f-6a91-45ad-9751-0d16a07f75b2" + ], + "x-ms-correlation-request-id": [ + "b65cb90f-6a91-45ad-9751-0d16a07f75b2" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015753Z:b65cb90f-6a91-45ad-9751-0d16a07f75b2" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:57:53 GMT" + ] + }, + "StatusCode": 204 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourcegroups/onesdk3036?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlZ3JvdXBzL29uZXNkazMwMzY/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"North Europe\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "34" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036\",\r\n \"name\": \"onesdk3036\",\r\n \"location\": \"northeurope\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "178" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-request-id": [ + "cffb9922-cdb4-4641-9c6a-e483f4ddfd49" + ], + "x-ms-correlation-request-id": [ + "cffb9922-cdb4-4641-9c6a-e483f4ddfd49" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015527Z:cffb9922-cdb4-4641-9c6a-e483f4ddfd49" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:55:27 GMT" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/resources?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcmVzb3VyY2VzP2FwaS12ZXJzaW9uPTIwMTQtMDQtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": []\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "12" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14936" + ], + "x-ms-request-id": [ + "4393d529-e6b0-4845-82c2-66e32ba2be78" + ], + "x-ms-correlation-request-id": [ + "4393d529-e6b0-4845-82c2-66e32ba2be78" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015527Z:4393d529-e6b0-4845-82c2-66e32ba2be78" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:55:27 GMT" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourcegroups/onesdk3036/providers/Microsoft.Authorization/permissions?api-version=2014-07-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlZ3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5BdXRob3JpemF0aW9uL3Blcm1pc3Npb25zP2FwaS12ZXJzaW9uPTIwMTQtMDctMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Authorization.AuthorizationManagementClient/0.9.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"actions\": [\r\n \"*\"\r\n ],\r\n \"notActions\": []\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "45" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:7b69eab1-53b8-47da-b317-6b61bf2a3e9a" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14938" + ], + "x-ms-correlation-request-id": [ + "9d33717c-b95b-40d5-a158-769b24e2e322" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015528Z:9d33717c-b95b-40d5-a158-769b24e2e322" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:55:28 GMT" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786?api-version=2014-04-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvc2VydmVycy9vbmVzZGs1Nzg2P2FwaS12ZXJzaW9uPTIwMTQtMDQtMDE=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Sql.SqlManagementClient/0.9.0.0" + ], + "x-ms-client-request-id": [ + "0660591e-eddb-4add-b2aa-e9b5669c1d0a" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceNotFound\",\r\n \"message\": \"The Resource 'Microsoft.Sql/servers/onesdk5786' under resource group 'onesdk3036' was not found.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "146" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-failure-cause": [ + "gateway" + ], + "x-ms-request-id": [ + "4e4a0117-6627-42c4-843a-f4cde461a603" + ], + "x-ms-correlation-request-id": [ + "4e4a0117-6627-42c4-843a-f4cde461a603" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015529Z:4e4a0117-6627-42c4-843a-f4cde461a603" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:55:29 GMT" + ] + }, + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786?api-version=2014-04-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvc2VydmVycy9vbmVzZGs1Nzg2P2FwaS12ZXJzaW9uPTIwMTQtMDQtMDE=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"version\": \"12.0\",\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"t357ingP@s5w0rd!\"\r\n },\r\n \"location\": \"North Europe\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "180" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Sql.SqlManagementClient/0.9.0.0" + ], + "x-ms-client-request-id": [ + "ed6fc38e-4018-46c8-884d-9ac920348137" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786\",\r\n \"name\": \"onesdk5786\",\r\n \"type\": \"Microsoft.Sql/servers\",\r\n \"location\": \"North Europe\",\r\n \"kind\": \"v12.0\",\r\n \"properties\": {\r\n \"fullyQualifiedDomainName\": \"onesdk5786.sqltest-eg1.mscds.com\",\r\n \"administratorLogin\": \"testusername\",\r\n \"administratorLoginPassword\": \"t357ingP@s5w0rd!\",\r\n \"externalAdministratorLogin\": null,\r\n \"externalAdministratorSid\": null,\r\n \"version\": \"12.0\",\r\n \"state\": \"Ready\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "481" + ], + "Content-Type": [ + "application/json; odata=minimalmetadata; streaming=true; charset=utf-8" + ], + "x-ms-request-id": [ + "9cf863c8-abdd-4b34-bbe3-e5ec0c8b3daa" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Preference-Applied": [ + "return-content" + ], + "DataServiceVersion": [ + "3.0;" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "x-ms-correlation-request-id": [ + "216980c3-8d60-429e-bcac-f6c04929463c" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015607Z:216980c3-8d60-429e-bcac-f6c04929463c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-store, no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:56:07 GMT" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administrators?api-version=2014-04-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvc2VydmVycy9vbmVzZGs1Nzg2L2FkbWluaXN0cmF0b3JzP2FwaS12ZXJzaW9uPTIwMTQtMDQtMDE=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Sql.SqlManagementClient/0.9.0.0" + ], + "x-ms-client-request-id": [ + "3853c1ad-81e4-4fe8-9b1f-64af6d76d387" + ] + }, + "ResponseBody": "{\r\n \"value\": []\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "12" + ], + "Content-Type": [ + "application/json; odata=minimalmetadata; streaming=true; charset=utf-8" + ], + "x-ms-request-id": [ + "c1722e6b-21ec-4120-95a4-8096792395a8" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "DataServiceVersion": [ + "3.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14953" + ], + "x-ms-correlation-request-id": [ + "b6b2f1b8-0686-4d96-a53b-ca5a5ce82ac6" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015608Z:b6b2f1b8-0686-4d96-a53b-ca5a5ce82ac6" + ], + "Cache-Control": [ + "no-store, no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:56:08 GMT" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administrators?api-version=2014-04-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvc2VydmVycy9vbmVzZGs1Nzg2L2FkbWluaXN0cmF0b3JzP2FwaS12ZXJzaW9uPTIwMTQtMDQtMDE=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Sql.SqlManagementClient/0.9.0.0" + ], + "x-ms-client-request-id": [ + "304873d1-de05-4e5b-ab2e-95f544facbf0" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/providers/Microsoft.Sql/administrators/ActiveDirectory\",\r\n \"name\": \"ActiveDirectory\",\r\n \"type\": \"Microsoft.Sql/servers/administrators\",\r\n \"location\": \"North Europe\",\r\n \"kind\": null,\r\n \"properties\": {\r\n \"administratorType\": \"ActiveDirectory\",\r\n \"login\": \"testAADaccount\",\r\n \"sid\": \"41732a4a-e09e-4b18-9624-38e252d68bbf\",\r\n \"tenantId\": \"78aa4711-fe84-48e8-ad6d-4e386e71062a\"\r\n }\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "478" + ], + "Content-Type": [ + "application/json; odata=minimalmetadata; streaming=true; charset=utf-8" + ], + "x-ms-request-id": [ + "683dd973-1fa6-4dc1-b8dc-e598ece72982" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "DataServiceVersion": [ + "3.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14949" + ], + "x-ms-correlation-request-id": [ + "41d3aea7-8146-4d63-a114-fdedf245fe0c" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015646Z:41d3aea7-8146-4d63-a114-fdedf245fe0c" + ], + "Cache-Control": [ + "no-store, no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:56:46 GMT" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administrators?api-version=2014-04-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvc2VydmVycy9vbmVzZGs1Nzg2L2FkbWluaXN0cmF0b3JzP2FwaS12ZXJzaW9uPTIwMTQtMDQtMDE=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Sql.SqlManagementClient/0.9.0.0" + ], + "x-ms-client-request-id": [ + "57db3955-5ae8-447a-b0e0-0ab8fdd48174" + ] + }, + "ResponseBody": "{\r\n \"value\": []\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "12" + ], + "Content-Type": [ + "application/json; odata=minimalmetadata; streaming=true; charset=utf-8" + ], + "x-ms-request-id": [ + "f52764b9-6675-4038-9771-cfd6daaeb6d6" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "DataServiceVersion": [ + "3.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14940" + ], + "x-ms-correlation-request-id": [ + "80f9092d-3eac-4b46-b8c1-93c5eed30de8" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015753Z:80f9092d-3eac-4b46-b8c1-93c5eed30de8" + ], + "Cache-Control": [ + "no-store, no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:57:52 GMT" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administrators/ActiveDirectory?api-version=2014-04-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvc2VydmVycy9vbmVzZGs1Nzg2L2FkbWluaXN0cmF0b3JzL0FjdGl2ZURpcmVjdG9yeT9hcGktdmVyc2lvbj0yMDE0LTA0LTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Sql.SqlManagementClient/0.9.0.0" + ], + "x-ms-client-request-id": [ + "4b22fca2-c3d8-4414-8dd7-b0ad443fbb73" + ] + }, + "ResponseBody": "{\r\n \"code\": \"NotFound\",\r\n \"message\": \"Server administrator with name 'ActiveDirectory' does not exist. To continue, specify a valid server administrator name.\",\r\n \"target\": null,\r\n \"details\": [],\r\n \"innererror\": []\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "205" + ], + "Content-Type": [ + "application/json" + ], + "x-ms-request-id": [ + "a7455483-ae28-46b8-8c64-5a3755e07fcb" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "DataServiceVersion": [ + "3.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14952" + ], + "x-ms-correlation-request-id": [ + "85672e8b-0770-40f4-b4fa-6a241d636c88" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015609Z:85672e8b-0770-40f4-b4fa-6a241d636c88" + ], + "Cache-Control": [ + "no-store, no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:56:08 GMT" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ] + }, + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administrators/ActiveDirectory?api-version=2014-04-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvc2VydmVycy9vbmVzZGs1Nzg2L2FkbWluaXN0cmF0b3JzL0FjdGl2ZURpcmVjdG9yeT9hcGktdmVyc2lvbj0yMDE0LTA0LTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Sql.SqlManagementClient/0.9.0.0" + ], + "x-ms-client-request-id": [ + "1da5fc99-d45a-49ab-8e14-c108d5b28e65" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/providers/Microsoft.Sql/administrators/ActiveDirectory\",\r\n \"name\": \"ActiveDirectory\",\r\n \"type\": \"Microsoft.Sql/servers/administrators\",\r\n \"location\": \"North Europe\",\r\n \"kind\": null,\r\n \"properties\": {\r\n \"administratorType\": \"ActiveDirectory\",\r\n \"login\": \"testAADaccount\",\r\n \"sid\": \"41732a4a-e09e-4b18-9624-38e252d68bbf\",\r\n \"tenantId\": \"78aa4711-fe84-48e8-ad6d-4e386e71062a\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "466" + ], + "Content-Type": [ + "application/json; odata=minimalmetadata; streaming=true; charset=utf-8" + ], + "x-ms-request-id": [ + "d1ec8897-8551-42e4-965c-74bcff9ba3aa" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "DataServiceVersion": [ + "3.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14948" + ], + "x-ms-correlation-request-id": [ + "892c1e5d-1ee8-42de-9384-56e9e8c010ef" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015647Z:892c1e5d-1ee8-42de-9384-56e9e8c010ef" + ], + "Cache-Control": [ + "no-store, no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:56:46 GMT" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administrators/ActiveDirectory?api-version=2014-04-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvc2VydmVycy9vbmVzZGs1Nzg2L2FkbWluaXN0cmF0b3JzL0FjdGl2ZURpcmVjdG9yeT9hcGktdmVyc2lvbj0yMDE0LTA0LTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Sql.SqlManagementClient/0.9.0.0" + ], + "x-ms-client-request-id": [ + "a6182b65-ad92-4bac-9a8f-d9670f6a55b5" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/providers/Microsoft.Sql/administrators/ActiveDirectory\",\r\n \"name\": \"ActiveDirectory\",\r\n \"type\": \"Microsoft.Sql/servers/administrators\",\r\n \"location\": \"North Europe\",\r\n \"kind\": null,\r\n \"properties\": {\r\n \"administratorType\": \"ActiveDirectory\",\r\n \"login\": \"Test User 2\",\r\n \"sid\": \"e87332b2-e3ed-480a-9723-e9b3611268f8\",\r\n \"tenantId\": \"78aa4711-fe84-48e8-ad6d-4e386e71062a\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "463" + ], + "Content-Type": [ + "application/json; odata=minimalmetadata; streaming=true; charset=utf-8" + ], + "x-ms-request-id": [ + "affb3878-705f-4926-beba-0d988137fecc" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "DataServiceVersion": [ + "3.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14943" + ], + "x-ms-correlation-request-id": [ + "f358a7e1-e2c2-4180-8f3e-a89152ebeeb9" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015720Z:f358a7e1-e2c2-4180-8f3e-a89152ebeeb9" + ], + "Cache-Control": [ + "no-store, no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:57:20 GMT" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/78aa4711-fe84-48e8-ad6d-4e386e71062a/groups?$filter=startswith(displayName,'testAADaccount')&api-version=1.42-previewInternal", + "EncodedRequestUri": "Lzc4YWE0NzExLWZlODQtNDhlOC1hZDZkLTRlMzg2ZTcxMDYyYS9ncm91cHM/JGZpbHRlcj1zdGFydHN3aXRoKGRpc3BsYXlOYW1lLCd0ZXN0QUFEYWNjb3VudCcpJmFwaS12ZXJzaW9uPTEuNDItcHJldmlld0ludGVybmFs", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Graph.RBAC.GraphRbacManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"odata.metadata\": \"https://graph.ppe.windows.net/78aa4711-fe84-48e8-ad6d-4e386e71062a/$metadata#directoryObjects/Microsoft.WindowsAzure.ActiveDirectory.Group\",\r\n \"value\": [\r\n {\r\n \"odata.type\": \"Microsoft.WindowsAzure.ActiveDirectory.Group\",\r\n \"objectType\": \"Group\",\r\n \"objectId\": \"41732a4a-e09e-4b18-9624-38e252d68bbf\",\r\n \"softDeletionTimestamp\": null,\r\n \"appMetadata\": null,\r\n \"exchangeResources\": [],\r\n \"description\": \"4dc34af5-6a71-4838-a983-14cdf8852ff9\",\r\n \"dirSyncEnabled\": null,\r\n \"displayName\": \"testAADaccount\",\r\n \"groupType\": null,\r\n \"isPublic\": null,\r\n \"lastDirSyncTime\": null,\r\n \"licenseAssignment\": [],\r\n \"mail\": null,\r\n \"mailNickname\": \"6d855ad8-3daf-40f2-85c7-38a16b008812\",\r\n \"mailEnabled\": false,\r\n \"onPremiseSecurityIdentifier\": null,\r\n \"provisioningErrors\": [],\r\n \"proxyAddresses\": [],\r\n \"securityEnabled\": true,\r\n \"sharepointResources\": []\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "771" + ], + "Content-Type": [ + "application/json; odata=minimalmetadata; streaming=true; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "ocp-aad-diagnostics-server-name": [ + "G8DD07yRIG0gx9VKA65+sgswJLifq/UvkcKJZsbVTOQ=" + ], + "request-id": [ + "a4889725-87e9-4e01-9e94-d33b97418377" + ], + "client-request-id": [ + "c82acacd-ac62-4e7a-a648-f038ec9019fe" + ], + "x-ms-gateway-rewrite": [ + "false" + ], + "x-ms-dirapi-data-contract-version": [ + "1.42-previewInternal" + ], + "ocp-aad-session-key": [ + "t-T2wcnR7ojmrJZDFoWhNySJML2sZkEG_t-dqWNlUwgtGHqnSEWrDZjNZnkopAN3m5XMaIsTPFsjIA0Frv7gexOhmmM3L-YRFPeq9sI_leoYnK-SBtPbSw6onPYMr9io.1ye9PH7Kb8KtMkF_xVHtC3Opuf1d3K3ILcbmHg8y1mM" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "DataServiceVersion": [ + "3.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Cache-Control": [ + "no-cache" + ], + "Server": [ + "Microsoft-IIS/8.5" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET", + "ASP.NET" + ], + "Date": [ + "Wed, 12 Aug 2015 01:56:09 GMT" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administrators/ActiveDirectory?api-version=2014-04-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvc2VydmVycy9vbmVzZGs1Nzg2L2FkbWluaXN0cmF0b3JzL0FjdGl2ZURpcmVjdG9yeT9hcGktdmVyc2lvbj0yMDE0LTA0LTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"login\": \"testAADaccount\",\r\n \"sid\": \"41732a4a-e09e-4b18-9624-38e252d68bbf\",\r\n \"administratorType\": \"activeDirectory\",\r\n \"tenantId\": \"78aa4711-fe84-48e8-ad6d-4e386e71062a\"\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "213" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Sql.SqlManagementClient/0.9.0.0" + ], + "x-ms-client-request-id": [ + "50b5d7a3-1b5e-4ab7-8201-63326f3f8fe4" + ] + }, + "ResponseBody": "{\r\n \"operation\": \"CreateActiveDirectoryAdministrator\",\r\n \"operationId\": \"ac3db4b2-88e3-4a64-8067-34e5d3526672\",\r\n \"percentComplete\": 0,\r\n \"startTime\": \"2015-08-12T01:56:14.01Z\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "161" + ], + "Content-Type": [ + "application/json; odata=minimalmetadata; streaming=true; charset=utf-8" + ], + "Retry-After": [ + "30" + ], + "x-ms-request-id": [ + "ac3db4b2-88e3-4a64-8067-34e5d3526672" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Preference-Applied": [ + "return-content" + ], + "DataServiceVersion": [ + "3.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "x-ms-correlation-request-id": [ + "1fb62d57-df42-4c49-bbba-4e1694dc6b74" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015614Z:1fb62d57-df42-4c49-bbba-4e1694dc6b74" + ], + "Cache-Control": [ + "no-store, no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:56:13 GMT" + ], + "Location": [ + "https://api-dogfood.resources.windows-int.net/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administratorOperationResults/ac3db4b2-88e3-4a64-8067-34e5d3526672?api-version=2014-04-01-Preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administrators/ActiveDirectory?api-version=2014-04-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvc2VydmVycy9vbmVzZGs1Nzg2L2FkbWluaXN0cmF0b3JzL0FjdGl2ZURpcmVjdG9yeT9hcGktdmVyc2lvbj0yMDE0LTA0LTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"login\": \"Test User 2\",\r\n \"sid\": \"e87332b2-e3ed-480a-9723-e9b3611268f8\",\r\n \"administratorType\": \"activeDirectory\",\r\n \"tenantId\": \"78aa4711-fe84-48e8-ad6d-4e386e71062a\"\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "210" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Sql.SqlManagementClient/0.9.0.0" + ], + "x-ms-client-request-id": [ + "c1abe072-4aac-4861-ad72-506b02198a3c" + ] + }, + "ResponseBody": "{\r\n \"operation\": \"UpdateActiveDirectoryAdministrator\",\r\n \"operationId\": \"5103f6a9-1acc-4f64-9650-35d30ec98c54\",\r\n \"percentComplete\": 0,\r\n \"startTime\": \"2015-08-12T01:56:47.982Z\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "161" + ], + "Content-Type": [ + "application/json; odata=minimalmetadata; streaming=true; charset=utf-8" + ], + "Retry-After": [ + "30" + ], + "x-ms-request-id": [ + "5103f6a9-1acc-4f64-9650-35d30ec98c54" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Preference-Applied": [ + "return-content" + ], + "DataServiceVersion": [ + "3.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1197" + ], + "x-ms-correlation-request-id": [ + "fe83d3c3-c8b9-42e6-88d5-1dd83ba28c3a" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015648Z:fe83d3c3-c8b9-42e6-88d5-1dd83ba28c3a" + ], + "Cache-Control": [ + "no-store, no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:56:47 GMT" + ], + "Location": [ + "https://api-dogfood.resources.windows-int.net/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administratorOperationResults/5103f6a9-1acc-4f64-9650-35d30ec98c54?api-version=2014-04-01-Preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administratorOperationResults/ac3db4b2-88e3-4a64-8067-34e5d3526672?api-version=2014-04-01-Preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvc2VydmVycy9vbmVzZGs1Nzg2L2FkbWluaXN0cmF0b3JPcGVyYXRpb25SZXN1bHRzL2FjM2RiNGIyLTg4ZTMtNGE2NC04MDY3LTM0ZTVkMzUyNjY3Mj9hcGktdmVyc2lvbj0yMDE0LTA0LTAxLVByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Sql.SqlManagementClient/0.9.0.0" + ], + "x-ms-client-request-id": [ + "50b5d7a3-1b5e-4ab7-8201-63326f3f8fe4" + ] + }, + "ResponseBody": "{\r\n \"operation\": \"CreateActiveDirectoryAdministrator\",\r\n \"operationId\": \"ac3db4b2-88e3-4a64-8067-34e5d3526672\",\r\n \"percentComplete\": 50,\r\n \"startTime\": \"2015-08-12T01:56:14.729Z\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "162" + ], + "Content-Type": [ + "application/json" + ], + "Retry-After": [ + "30" + ], + "x-ms-request-id": [ + "6dc1b4d5-93d5-45e0-bda3-02e27f36e2a3" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "DataServiceVersion": [ + "3.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14951" + ], + "x-ms-correlation-request-id": [ + "e11c3301-0fb9-41ff-97df-b9960c445efb" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015615Z:e11c3301-0fb9-41ff-97df-b9960c445efb" + ], + "Cache-Control": [ + "no-store, no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:56:14 GMT" + ], + "Location": [ + "https://api-dogfood.resources.windows-int.net/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administratorOperationResults/ac3db4b2-88e3-4a64-8067-34e5d3526672?api-version=2014-04-01-Preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administratorOperationResults/ac3db4b2-88e3-4a64-8067-34e5d3526672?api-version=2014-04-01-Preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvc2VydmVycy9vbmVzZGs1Nzg2L2FkbWluaXN0cmF0b3JPcGVyYXRpb25SZXN1bHRzL2FjM2RiNGIyLTg4ZTMtNGE2NC04MDY3LTM0ZTVkMzUyNjY3Mj9hcGktdmVyc2lvbj0yMDE0LTA0LTAxLVByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Sql.SqlManagementClient/0.9.0.0" + ], + "x-ms-client-request-id": [ + "50b5d7a3-1b5e-4ab7-8201-63326f3f8fe4" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administratorOperationResults/ActiveDirectory\",\r\n \"name\": \"ActiveDirectory\",\r\n \"type\": \"Microsoft.Sql/servers/administrators\",\r\n \"location\": \"North Europe\",\r\n \"kind\": null,\r\n \"properties\": {\r\n \"administratorType\": \"ActiveDirectory\",\r\n \"login\": \"testAADaccount\",\r\n \"sid\": \"41732a4a-e09e-4b18-9624-38e252d68bbf\",\r\n \"tenantId\": \"78aa4711-fe84-48e8-ad6d-4e386e71062a\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "457" + ], + "Content-Type": [ + "application/json; odata=minimalmetadata; streaming=true; charset=utf-8" + ], + "x-ms-request-id": [ + "5749e547-acdc-4011-818b-a14e9c787bb2" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "DataServiceVersion": [ + "3.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14950" + ], + "x-ms-correlation-request-id": [ + "24c423af-99d3-4ae2-afb8-fd3e7ecf0814" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015646Z:24c423af-99d3-4ae2-afb8-fd3e7ecf0814" + ], + "Cache-Control": [ + "no-store, no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:56:45 GMT" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/78aa4711-fe84-48e8-ad6d-4e386e71062a/groups?$filter=startswith(displayName,'Test%20User%202')&api-version=1.42-previewInternal", + "EncodedRequestUri": "Lzc4YWE0NzExLWZlODQtNDhlOC1hZDZkLTRlMzg2ZTcxMDYyYS9ncm91cHM/JGZpbHRlcj1zdGFydHN3aXRoKGRpc3BsYXlOYW1lLCdUZXN0JTIwVXNlciUyMDInKSZhcGktdmVyc2lvbj0xLjQyLXByZXZpZXdJbnRlcm5hbA==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Graph.RBAC.GraphRbacManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"odata.metadata\": \"https://graph.ppe.windows.net/78aa4711-fe84-48e8-ad6d-4e386e71062a/$metadata#directoryObjects/Microsoft.WindowsAzure.ActiveDirectory.Group\",\r\n \"value\": []\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "170" + ], + "Content-Type": [ + "application/json; odata=minimalmetadata; streaming=true; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "ocp-aad-diagnostics-server-name": [ + "G8DD07yRIG0gx9VKA65+sgswJLifq/UvkcKJZsbVTOQ=" + ], + "request-id": [ + "41602553-ffd2-4f2c-ac2d-61611338b56d" + ], + "client-request-id": [ + "176367e4-cf18-41c5-aa9a-d1d26f186ad7" + ], + "x-ms-gateway-rewrite": [ + "false" + ], + "x-ms-dirapi-data-contract-version": [ + "1.42-previewInternal" + ], + "ocp-aad-session-key": [ + "O3XkVfBSJPuYuv3lt1dZpYcCeloBWK-aJrUzoxAbMe8B0k_ke1P0ImQ6jmJogDw-I15gMpQtna77KruqOQZ9vECHJCwXD4koHPSTa6GV0NIwtayoulTCV_UcnHDOHu7G.XJwh2AdCxXIRVhAZhCJtSM7D5PmpoFzOwGC4aIp99fk" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "DataServiceVersion": [ + "3.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Cache-Control": [ + "no-cache" + ], + "Server": [ + "Microsoft-IIS/8.5" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET", + "ASP.NET" + ], + "Date": [ + "Wed, 12 Aug 2015 01:56:47 GMT" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/78aa4711-fe84-48e8-ad6d-4e386e71062a/users?$filter=startswith(displayName,'Test%20User%202')&api-version=1.42-previewInternal", + "EncodedRequestUri": "Lzc4YWE0NzExLWZlODQtNDhlOC1hZDZkLTRlMzg2ZTcxMDYyYS91c2Vycz8kZmlsdGVyPXN0YXJ0c3dpdGgoZGlzcGxheU5hbWUsJ1Rlc3QlMjBVc2VyJTIwMicpJmFwaS12ZXJzaW9uPTEuNDItcHJldmlld0ludGVybmFs", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Graph.RBAC.GraphRbacManagementClient/1.0.0.0" + ] + }, + "ResponseBody": "{\r\n \"odata.metadata\": \"https://graph.ppe.windows.net/78aa4711-fe84-48e8-ad6d-4e386e71062a/$metadata#directoryObjects/Microsoft.WindowsAzure.ActiveDirectory.User\",\r\n \"value\": [\r\n {\r\n \"odata.type\": \"Microsoft.WindowsAzure.ActiveDirectory.User\",\r\n \"objectType\": \"User\",\r\n \"objectId\": \"e87332b2-e3ed-480a-9723-e9b3611268f8\",\r\n \"softDeletionTimestamp\": null,\r\n \"acceptedAs\": null,\r\n \"acceptedOn\": null,\r\n \"accountEnabled\": true,\r\n \"alternativeSecurityIds\": [\r\n {\r\n \"type\": 5,\r\n \"identityProvider\": null,\r\n \"key\": \"EAN//otgYMA=\"\r\n }\r\n ],\r\n \"appMetadata\": null,\r\n \"assignedLicenses\": [],\r\n \"assignedPlans\": [],\r\n \"city\": null,\r\n \"country\": null,\r\n \"creationType\": null,\r\n \"department\": null,\r\n \"dirSyncEnabled\": null,\r\n \"displayName\": \"Test User 2\",\r\n \"extensionAttribute1\": null,\r\n \"extensionAttribute2\": null,\r\n \"extensionAttribute3\": null,\r\n \"extensionAttribute4\": null,\r\n \"extensionAttribute5\": null,\r\n \"extensionAttribute6\": null,\r\n \"extensionAttribute7\": null,\r\n \"extensionAttribute8\": null,\r\n \"extensionAttribute9\": null,\r\n \"extensionAttribute10\": null,\r\n \"extensionAttribute11\": null,\r\n \"extensionAttribute12\": null,\r\n \"extensionAttribute13\": null,\r\n \"extensionAttribute14\": null,\r\n \"extensionAttribute15\": null,\r\n \"facsimileTelephoneNumber\": null,\r\n \"givenName\": \"User2\",\r\n \"immutableId\": null,\r\n \"invitedOn\": null,\r\n \"inviteReplyUrl\": [],\r\n \"inviteResources\": [],\r\n \"inviteTicket\": [],\r\n \"isCompromised\": null,\r\n \"jobTitle\": null,\r\n \"jrnlAddress\": null,\r\n \"lastDirSyncTime\": null,\r\n \"logonIdentifiers\": [],\r\n \"mail\": null,\r\n \"mailNickname\": \"user2_aad112b.ccsctp.net#EXT#\",\r\n \"mobile\": null,\r\n \"netId\": \"100300008B63B5F1\",\r\n \"onPremiseSecurityIdentifier\": null,\r\n \"otherMails\": [\r\n \"user2@aad112b.ccsctp.net\"\r\n ],\r\n \"passwordPolicies\": \"None\",\r\n \"passwordProfile\": null,\r\n \"physicalDeliveryOfficeName\": null,\r\n \"postalCode\": null,\r\n \"preferredLanguage\": null,\r\n \"primarySMTPAddress\": null,\r\n \"provisionedPlans\": [],\r\n \"provisioningErrors\": [],\r\n \"proxyAddresses\": [],\r\n \"searchableDeviceKey\": [],\r\n \"selfServePasswordResetData\": null,\r\n \"signInName\": \"user2@aad112b.ccsctp.net\",\r\n \"sipProxyAddress\": null,\r\n \"smtpAddresses\": [],\r\n \"state\": null,\r\n \"streetAddress\": null,\r\n \"surname\": \"Test2\",\r\n \"telephoneNumber\": null,\r\n \"usageLocation\": null,\r\n \"userPrincipalName\": \"user2_aad112b.ccsctp.net#EXT#@aad112.ccsctp.net\",\r\n \"userState\": null,\r\n \"userStateChangedOn\": null,\r\n \"userType\": \"Member\"\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "2068" + ], + "Content-Type": [ + "application/json; odata=minimalmetadata; streaming=true; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "ocp-aad-diagnostics-server-name": [ + "3KJX1Gy2hruUIUgwZttKte3ayI+bWJZKm1QQ2LDyX2Q=" + ], + "request-id": [ + "a2c09668-b711-4dc2-be19-5fd7860c4eb5" + ], + "client-request-id": [ + "7cce7215-3eb0-43e9-88ac-ca869a58e150" + ], + "x-ms-gateway-rewrite": [ + "false" + ], + "x-ms-dirapi-data-contract-version": [ + "1.42-previewInternal" + ], + "ocp-aad-session-key": [ + "O9l5BHR62joEDOPQQ0eHSXzUtjpIbddgiBDGbruvhAYNH2kM1e9UAf_37Jss7bl9GpnRb2MCKVGf7jLlO7N97V_ja2qtiV9B-qgdQU0G3NsyCLng5f5xFXN5Q1DAKjSm.LljxpthTL2Vv40ZVfWqPZmm1b2HL-J798W8uFrsWxBo" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "DataServiceVersion": [ + "3.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Access-Control-Allow-Origin": [ + "*" + ], + "Cache-Control": [ + "no-cache" + ], + "Server": [ + "Microsoft-IIS/8.5" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET", + "ASP.NET" + ], + "Date": [ + "Wed, 12 Aug 2015 01:56:47 GMT" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administratorOperationResults/5103f6a9-1acc-4f64-9650-35d30ec98c54?api-version=2014-04-01-Preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvc2VydmVycy9vbmVzZGs1Nzg2L2FkbWluaXN0cmF0b3JPcGVyYXRpb25SZXN1bHRzLzUxMDNmNmE5LTFhY2MtNGY2NC05NjUwLTM1ZDMwZWM5OGM1ND9hcGktdmVyc2lvbj0yMDE0LTA0LTAxLVByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Sql.SqlManagementClient/0.9.0.0" + ], + "x-ms-client-request-id": [ + "c1abe072-4aac-4861-ad72-506b02198a3c" + ] + }, + "ResponseBody": "{\r\n \"operation\": \"UpdateActiveDirectoryAdministrator\",\r\n \"operationId\": \"5103f6a9-1acc-4f64-9650-35d30ec98c54\",\r\n \"percentComplete\": 50,\r\n \"startTime\": \"2015-08-12T01:56:48.622Z\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "162" + ], + "Content-Type": [ + "application/json" + ], + "Retry-After": [ + "30" + ], + "x-ms-request-id": [ + "53865c8a-9db7-4fb9-8dea-5924dbdf5130" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "DataServiceVersion": [ + "3.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14947" + ], + "x-ms-correlation-request-id": [ + "dffa0f3a-9644-4535-87d5-b750dae86f64" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015649Z:dffa0f3a-9644-4535-87d5-b750dae86f64" + ], + "Cache-Control": [ + "no-store, no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:56:49 GMT" + ], + "Location": [ + "https://api-dogfood.resources.windows-int.net/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administratorOperationResults/5103f6a9-1acc-4f64-9650-35d30ec98c54?api-version=2014-04-01-Preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administratorOperationResults/5103f6a9-1acc-4f64-9650-35d30ec98c54?api-version=2014-04-01-Preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvc2VydmVycy9vbmVzZGs1Nzg2L2FkbWluaXN0cmF0b3JPcGVyYXRpb25SZXN1bHRzLzUxMDNmNmE5LTFhY2MtNGY2NC05NjUwLTM1ZDMwZWM5OGM1ND9hcGktdmVyc2lvbj0yMDE0LTA0LTAxLVByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Sql.SqlManagementClient/0.9.0.0" + ], + "x-ms-client-request-id": [ + "c1abe072-4aac-4861-ad72-506b02198a3c" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administratorOperationResults/ActiveDirectory\",\r\n \"name\": \"ActiveDirectory\",\r\n \"type\": \"Microsoft.Sql/servers/administrators\",\r\n \"location\": \"North Europe\",\r\n \"kind\": null,\r\n \"properties\": {\r\n \"administratorType\": \"ActiveDirectory\",\r\n \"login\": \"Test User 2\",\r\n \"sid\": \"e87332b2-e3ed-480a-9723-e9b3611268f8\",\r\n \"tenantId\": \"78aa4711-fe84-48e8-ad6d-4e386e71062a\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "454" + ], + "Content-Type": [ + "application/json; odata=minimalmetadata; streaming=true; charset=utf-8" + ], + "x-ms-request-id": [ + "8e209e9d-551d-4f87-94e5-3fbcd41759ad" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "DataServiceVersion": [ + "3.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14944" + ], + "x-ms-correlation-request-id": [ + "4da3444c-bf0a-4257-b37c-086f878ced4d" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015720Z:4da3444c-bf0a-4257-b37c-086f878ced4d" + ], + "Cache-Control": [ + "no-store, no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:57:19 GMT" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administrators/ActiveDirectory?api-version=2014-04-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvc2VydmVycy9vbmVzZGs1Nzg2L2FkbWluaXN0cmF0b3JzL0FjdGl2ZURpcmVjdG9yeT9hcGktdmVyc2lvbj0yMDE0LTA0LTAx", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Sql.SqlManagementClient/0.9.0.0" + ], + "x-ms-client-request-id": [ + "ea66a865-9787-4b09-89b3-f753f02660e3" + ] + }, + "ResponseBody": "{\r\n \"operation\": \"DropActiveDirectoryAdministrator\",\r\n \"operationId\": \"bf490fb7-9c0d-4876-b5bd-34703e910cd9\",\r\n \"percentComplete\": 0,\r\n \"startTime\": \"2015-08-12T01:57:20.91Z\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "159" + ], + "Content-Type": [ + "application/xml; charset=utf-8" + ], + "Retry-After": [ + "30" + ], + "x-ms-request-id": [ + "bf490fb7-9c0d-4876-b5bd-34703e910cd9" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "DataServiceVersion": [ + "1.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "x-ms-correlation-request-id": [ + "6fbcf132-9dc5-4560-8f53-ea0e65407246" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015721Z:6fbcf132-9dc5-4560-8f53-ea0e65407246" + ], + "Cache-Control": [ + "no-store, no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:57:20 GMT" + ], + "Location": [ + "https://api-dogfood.resources.windows-int.net/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administratorOperationResults/bf490fb7-9c0d-4876-b5bd-34703e910cd9?api-version=2014-04-01-Preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administratorOperationResults/bf490fb7-9c0d-4876-b5bd-34703e910cd9?api-version=2014-04-01-Preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvc2VydmVycy9vbmVzZGs1Nzg2L2FkbWluaXN0cmF0b3JPcGVyYXRpb25SZXN1bHRzL2JmNDkwZmI3LTljMGQtNDg3Ni1iNWJkLTM0NzAzZTkxMGNkOT9hcGktdmVyc2lvbj0yMDE0LTA0LTAxLVByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Sql.SqlManagementClient/0.9.0.0" + ], + "x-ms-client-request-id": [ + "ea66a865-9787-4b09-89b3-f753f02660e3" + ] + }, + "ResponseBody": "{\r\n \"operation\": \"DropActiveDirectoryAdministrator\",\r\n \"operationId\": \"bf490fb7-9c0d-4876-b5bd-34703e910cd9\",\r\n \"percentComplete\": 50,\r\n \"startTime\": \"2015-08-12T01:57:21.567Z\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "160" + ], + "Content-Type": [ + "application/json" + ], + "Retry-After": [ + "30" + ], + "x-ms-request-id": [ + "30702fca-938f-4869-9112-f1da0a915446" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "DataServiceVersion": [ + "3.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14942" + ], + "x-ms-correlation-request-id": [ + "e3a08833-bc82-4461-b3ff-dd05a142206e" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015722Z:e3a08833-bc82-4461-b3ff-dd05a142206e" + ], + "Cache-Control": [ + "no-store, no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:57:22 GMT" + ], + "Location": [ + "https://api-dogfood.resources.windows-int.net/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administratorOperationResults/bf490fb7-9c0d-4876-b5bd-34703e910cd9?api-version=2014-04-01-Preview" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourceGroups/onesdk3036/providers/Microsoft.Sql/servers/onesdk5786/administratorOperationResults/bf490fb7-9c0d-4876-b5bd-34703e910cd9?api-version=2014-04-01-Preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlR3JvdXBzL29uZXNkazMwMzYvcHJvdmlkZXJzL01pY3Jvc29mdC5TcWwvc2VydmVycy9vbmVzZGs1Nzg2L2FkbWluaXN0cmF0b3JPcGVyYXRpb25SZXN1bHRzL2JmNDkwZmI3LTljMGQtNDg3Ni1iNWJkLTM0NzAzZTkxMGNkOT9hcGktdmVyc2lvbj0yMDE0LTA0LTAxLVByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Sql.SqlManagementClient/0.9.0.0" + ], + "x-ms-client-request-id": [ + "ea66a865-9787-4b09-89b3-f753f02660e3" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "x-ms-request-id": [ + "535c6247-8931-4132-8508-d4c8a9da36ca" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "DataServiceVersion": [ + "3.0;" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14941" + ], + "x-ms-correlation-request-id": [ + "d6264a26-259b-4320-a580-0378f2f9caa9" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015752Z:d6264a26-259b-4320-a580-0378f2f9caa9" + ], + "Cache-Control": [ + "no-store, no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:57:52 GMT" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/resourcegroups/onesdk3036?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL3Jlc291cmNlZ3JvdXBzL29uZXNkazMwMzY/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "x-ms-request-id": [ + "99ff451c-8921-4347-b241-4f3a82fdaaa4" + ], + "x-ms-correlation-request-id": [ + "99ff451c-8921-4347-b241-4f3a82fdaaa4" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015755Z:99ff451c-8921-4347-b241-4f3a82fdaaa4" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:57:55 GMT" + ], + "Location": [ + "https://api-dogfood.resources.windows-int.net/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1PTkVTREszMDM2LU5PUlRIRVVST1BFIiwiam9iTG9jYXRpb24iOiJub3J0aGV1cm9wZSJ9?api-version=2014-04-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1PTkVTREszMDM2LU5PUlRIRVVST1BFIiwiam9iTG9jYXRpb24iOiJub3J0aGV1cm9wZSJ9?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFQVGtWVFJFc3pNRE0yTFU1UFVsUklSVlZTVDFCRklpd2lhbTlpVEc5allYUnBiMjRpT2lKdWIzSjBhR1YxY205d1pTSjk/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2014-04-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14934" + ], + "x-ms-request-id": [ + "7c551cf0-c665-418c-af73-499fe7e8d92e" + ], + "x-ms-correlation-request-id": [ + "7c551cf0-c665-418c-af73-499fe7e8d92e" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015756Z:7c551cf0-c665-418c-af73-499fe7e8d92e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:57:55 GMT" + ], + "Location": [ + "https://api-dogfood.resources.windows-int.net/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1PTkVTREszMDM2LU5PUlRIRVVST1BFIiwiam9iTG9jYXRpb24iOiJub3J0aGV1cm9wZSJ9?api-version=2014-04-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1PTkVTREszMDM2LU5PUlRIRVVST1BFIiwiam9iTG9jYXRpb24iOiJub3J0aGV1cm9wZSJ9?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFQVGtWVFJFc3pNRE0yTFU1UFVsUklSVlZTVDFCRklpd2lhbTlpVEc5allYUnBiMjRpT2lKdWIzSjBhR1YxY205d1pTSjk/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2014-04-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14933" + ], + "x-ms-request-id": [ + "a14c653f-bad7-46f9-af21-752b72ea428f" + ], + "x-ms-correlation-request-id": [ + "a14c653f-bad7-46f9-af21-752b72ea428f" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015811Z:a14c653f-bad7-46f9-af21-752b72ea428f" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:58:10 GMT" + ], + "Location": [ + "https://api-dogfood.resources.windows-int.net/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1PTkVTREszMDM2LU5PUlRIRVVST1BFIiwiam9iTG9jYXRpb24iOiJub3J0aGV1cm9wZSJ9?api-version=2014-04-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1PTkVTREszMDM2LU5PUlRIRVVST1BFIiwiam9iTG9jYXRpb24iOiJub3J0aGV1cm9wZSJ9?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFQVGtWVFJFc3pNRE0yTFU1UFVsUklSVlZTVDFCRklpd2lhbTlpVEc5allYUnBiMjRpT2lKdWIzSjBhR1YxY205d1pTSjk/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2014-04-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14932" + ], + "x-ms-request-id": [ + "25b0438e-d214-48b3-93b2-70c9bd029a3d" + ], + "x-ms-correlation-request-id": [ + "25b0438e-d214-48b3-93b2-70c9bd029a3d" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015826Z:25b0438e-d214-48b3-93b2-70c9bd029a3d" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:58:26 GMT" + ], + "Location": [ + "https://api-dogfood.resources.windows-int.net/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1PTkVTREszMDM2LU5PUlRIRVVST1BFIiwiam9iTG9jYXRpb24iOiJub3J0aGV1cm9wZSJ9?api-version=2014-04-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1PTkVTREszMDM2LU5PUlRIRVVST1BFIiwiam9iTG9jYXRpb24iOiJub3J0aGV1cm9wZSJ9?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFQVGtWVFJFc3pNRE0yTFU1UFVsUklSVlZTVDFCRklpd2lhbTlpVEc5allYUnBiMjRpT2lKdWIzSjBhR1YxY205d1pTSjk/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2014-04-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14931" + ], + "x-ms-request-id": [ + "800144b1-4a06-43f8-b2bb-64a75ab681c5" + ], + "x-ms-correlation-request-id": [ + "800144b1-4a06-43f8-b2bb-64a75ab681c5" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015841Z:800144b1-4a06-43f8-b2bb-64a75ab681c5" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:58:41 GMT" + ], + "Location": [ + "https://api-dogfood.resources.windows-int.net/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1PTkVTREszMDM2LU5PUlRIRVVST1BFIiwiam9iTG9jYXRpb24iOiJub3J0aGV1cm9wZSJ9?api-version=2014-04-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1PTkVTREszMDM2LU5PUlRIRVVST1BFIiwiam9iTG9jYXRpb24iOiJub3J0aGV1cm9wZSJ9?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFQVGtWVFJFc3pNRE0yTFU1UFVsUklSVlZTVDFCRklpd2lhbTlpVEc5allYUnBiMjRpT2lKdWIzSjBhR1YxY205d1pTSjk/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2014-04-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14930" + ], + "x-ms-request-id": [ + "32acbd51-2f60-4153-aa96-96e40c488389" + ], + "x-ms-correlation-request-id": [ + "32acbd51-2f60-4153-aa96-96e40c488389" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015857Z:32acbd51-2f60-4153-aa96-96e40c488389" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:58:57 GMT" + ], + "Location": [ + "https://api-dogfood.resources.windows-int.net/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1PTkVTREszMDM2LU5PUlRIRVVST1BFIiwiam9iTG9jYXRpb24iOiJub3J0aGV1cm9wZSJ9?api-version=2014-04-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1PTkVTREszMDM2LU5PUlRIRVVST1BFIiwiam9iTG9jYXRpb24iOiJub3J0aGV1cm9wZSJ9?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFQVGtWVFJFc3pNRE0yTFU1UFVsUklSVlZTVDFCRklpd2lhbTlpVEc5allYUnBiMjRpT2lKdWIzSjBhR1YxY205d1pTSjk/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2014-04-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14929" + ], + "x-ms-request-id": [ + "b0f64033-04b2-4299-9708-99686e9b4f15" + ], + "x-ms-correlation-request-id": [ + "b0f64033-04b2-4299-9708-99686e9b4f15" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015912Z:b0f64033-04b2-4299-9708-99686e9b4f15" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:59:12 GMT" + ], + "Location": [ + "https://api-dogfood.resources.windows-int.net/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1PTkVTREszMDM2LU5PUlRIRVVST1BFIiwiam9iTG9jYXRpb24iOiJub3J0aGV1cm9wZSJ9?api-version=2014-04-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1PTkVTREszMDM2LU5PUlRIRVVST1BFIiwiam9iTG9jYXRpb24iOiJub3J0aGV1cm9wZSJ9?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFQVGtWVFJFc3pNRE0yTFU1UFVsUklSVlZTVDFCRklpd2lhbTlpVEc5allYUnBiMjRpT2lKdWIzSjBhR1YxY205d1pTSjk/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2014-04-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "Retry-After": [ + "15" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14927" + ], + "x-ms-request-id": [ + "8b7fa67a-a6a0-40ba-813a-3320de40aed4" + ], + "x-ms-correlation-request-id": [ + "8b7fa67a-a6a0-40ba-813a-3320de40aed4" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015927Z:8b7fa67a-a6a0-40ba-813a-3320de40aed4" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:59:27 GMT" + ], + "Location": [ + "https://api-dogfood.resources.windows-int.net/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1PTkVTREszMDM2LU5PUlRIRVVST1BFIiwiam9iTG9jYXRpb24iOiJub3J0aGV1cm9wZSJ9?api-version=2014-04-01-preview" + ] + }, + "StatusCode": 202 + }, + { + "RequestUri": "/subscriptions/5b19b3ec-b62d-4835-874b-848d6da82b12/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1PTkVTREszMDM2LU5PUlRIRVVST1BFIiwiam9iTG9jYXRpb24iOiJub3J0aGV1cm9wZSJ9?api-version=2014-04-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNWIxOWIzZWMtYjYyZC00ODM1LTg3NGItODQ4ZDZkYTgyYjEyL29wZXJhdGlvbnJlc3VsdHMvZXlKcWIySkpaQ0k2SWxKRlUwOVZVa05GUjFKUFZWQkVSVXhGVkVsUFRrcFBRaTFQVGtWVFJFc3pNRE0yTFU1UFVsUklSVlZTVDFCRklpd2lhbTlpVEc5allYUnBiMjRpT2lKdWIzSjBhR1YxY205d1pTSjk/YXBpLXZlcnNpb249MjAxNC0wNC0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-version": [ + "2014-04-01-preview" + ], + "User-Agent": [ + "Microsoft.Azure.Management.Resources.ResourceManagementClient/2.0.0.0" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14926" + ], + "x-ms-request-id": [ + "94e50306-e2ce-4794-a246-4c20e77367ed" + ], + "x-ms-correlation-request-id": [ + "94e50306-e2ce-4794-a246-4c20e77367ed" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20150812T015943Z:94e50306-e2ce-4794-a246-4c20e77367ed" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 12 Aug 2015 01:59:43 GMT" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "Test-ServerActiveDirectoryAdministrator": [ + "onesdk3036", + "onesdk5786" + ] + }, + "Variables": { + "SubscriptionId": "5b19b3ec-b62d-4835-874b-848d6da82b12", + "TenantId": "78aa4711-fe84-48e8-ad6d-4e386e71062a", + "Domain": "aad112.ccsctp.net", + "User": "admin@aad112.ccsctp.net" + } +} \ No newline at end of file diff --git a/src/ResourceManager/Sql/Commands.Sql.Test/packages.config b/src/ResourceManager/Sql/Commands.Sql.Test/packages.config index d2a2ffa4095b..3b48ed036b92 100644 --- a/src/ResourceManager/Sql/Commands.Sql.Test/packages.config +++ b/src/ResourceManager/Sql/Commands.Sql.Test/packages.config @@ -7,7 +7,7 @@ - + diff --git a/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj b/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj index 137d8396244d..1382100fc814 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj +++ b/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj @@ -103,6 +103,13 @@ + + + + + + + @@ -204,7 +211,7 @@ True - ..\..\..\packages\Microsoft.Azure.Management.Sql.0.32.0-prerelease\lib\net40\Microsoft.Azure.Management.Sql.dll + ..\..\..\packages\Microsoft.Azure.Management.Sql.0.36.0-prerelease\lib\net40\Microsoft.Azure.Management.Sql.dll False @@ -303,6 +310,11 @@ {5ee72c53-1720-4309-b54b-5fb79703195f} Commands.Common + + {e1f5201d-6067-430e-b303-4e367652991b} + Commands.Resources + MicrosoftAzureCommandsResources + @@ -318,4 +330,4 @@ - + \ No newline at end of file diff --git a/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/NewAzureSqlElasticPool.cs b/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/NewAzureSqlElasticPool.cs index b0f47031c2a1..e4ca4d73df36 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/NewAzureSqlElasticPool.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/NewAzureSqlElasticPool.cs @@ -134,7 +134,7 @@ protected override IEnumerable ApplyUserInputToModel(I DatabaseDtuMin = MyInvocation.BoundParameters.ContainsKey("DatabaseDtuMin") ? (int?)DatabaseDtuMin : null, Dtu = MyInvocation.BoundParameters.ContainsKey("Dtu") ? (int?)Dtu : null, Edition = MyInvocation.BoundParameters.ContainsKey("Edition") ? (DatabaseEdition?)Edition : null, - StorageMB = MyInvocation.BoundParameters.ContainsKey("StorageMB") ? (long?)StorageMB : null, + StorageMB = MyInvocation.BoundParameters.ContainsKey("StorageMB") ? (int?)StorageMB : null, }); return newEntity; } diff --git a/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/SetAzureSqlElasticPool.cs b/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/SetAzureSqlElasticPool.cs index dc0471df6b14..4f5cbb46e878 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/SetAzureSqlElasticPool.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/SetAzureSqlElasticPool.cs @@ -115,7 +115,7 @@ protected override IEnumerable ApplyUserInputToModel(I DatabaseDtuMin = MyInvocation.BoundParameters.ContainsKey("DatabaseDtuMin") ? (int?)DatabaseDtuMin : null, Dtu = MyInvocation.BoundParameters.ContainsKey("Dtu") ? (int?)Dtu : null, Edition = MyInvocation.BoundParameters.ContainsKey("Edition") ? (DatabaseEdition?)Edition : null, - StorageMB = MyInvocation.BoundParameters.ContainsKey("StorageMB") ? (long?)StorageMB : null, + StorageMB = MyInvocation.BoundParameters.ContainsKey("StorageMB") ? (int?)StorageMB : null, }); return newEntity; } diff --git a/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Model/AzureSqlElasticPoolModel.cs b/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Model/AzureSqlElasticPoolModel.cs index e94e7b0f8e61..34a2535511b4 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Model/AzureSqlElasticPoolModel.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Model/AzureSqlElasticPoolModel.cs @@ -81,7 +81,7 @@ public class AzureSqlElasticPoolModel /// /// Gets or sets the amount of storage the elastic pool has /// - public long? StorageMB { get; set; } + public int? StorageMB { get; set; } /// /// Gets or sets the tags associated with the Elastic Pool. diff --git a/src/ResourceManager/Sql/Commands.Sql/Microsoft.Azure.Commands.Sql.dll-Help.xml b/src/ResourceManager/Sql/Commands.Sql/Microsoft.Azure.Commands.Sql.dll-Help.xml index eeeb75544a58..b3c0925595e2 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Microsoft.Azure.Commands.Sql.dll-Help.xml +++ b/src/ResourceManager/Sql/Commands.Sql/Microsoft.Azure.Commands.Sql.dll-Help.xml @@ -1639,6 +1639,126 @@ Switch-AzureMode –Name AzureResourceManager + + + Get-AzureSqlServerActiveDirectoryAdministrator + + The Get-AzureSqlServerActiveDirectoryAdministrator cmdlet returns information about an Azure Active Directory administrator for an Azure SQL Server in the current subscription. + + + + + Get + AzureSqlServerActiveDirectoryAdministrator + + + + Note: This cmdlet can only be executed in Azure Resource Manager mode. To enable Azure Resource Manager mode run the following command: +Switch-AzureMode –Name AzureResourceManager + For more information, see Using Windows PowerShell with Resource Manager. + + + + Get-AzureSqlServerActiveDirectoryAdministrator + + ServerName + + The name of the Azure SQL Server containing the Azure Active Directory administrator. + + String + + + ResourceGroupName + + The name of the resource group containing the Azure SQL Server. + + String + + + Profile + + In-memory profile. + + AzureProfile + + + + + + ServerName + + The name of the Azure SQL Server containing the Azure Active Directory administrator. + + String + + String + + + none + + + ResourceGroupName + + The name of the resource group containing the Azure SQL Server. + + String + + String + + + none + + + Profile + + In-memory profile. + + AzureProfile + + AzureProfile + + + none + + + + + + InputType + + + + + System.String + + + + + + + OutputType + + + + + System.Object + + + + + + + + + This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters. + + + + + + + + Get-AzureSqlDatabaseTransparentDataEncryption @@ -6451,6 +6571,183 @@ Switch-AzureMode –Name AzureResourceManager + + + Remove-AzureSqlServerActiveDirectoryAdministrator + + Removes an Azure Active Directory administrator for an Azure SQL Server in the current subscription. + + + + + Remove + AzureSqlServerActiveDirectoryAdministrator + + + + Note: This cmdlet can only be executed in Azure Resource Manager mode. To enable Azure Resource Manager mode run the following command: +Switch-AzureMode –Name AzureResourceManager + For more information, see Using Windows PowerShell with Resource Manager. + + + + Remove-AzureSqlServerActiveDirectoryAdministrator + + ServerName + + The name of the Azure SQL Server to remove. + + String + + + Force + + Skip confirmation message and remove the Azure SQL Server Active Directory administrator. + + SwitchParameter + + + ResourceGroupName + + The name of the resource group that contains the Azure SQL Server Active Directory administrator to remove. + + String + + + Profile + + In-memory profile. + + AzureProfile + + + WhatIf + + + + SwitchParameter + + + Confirm + + + + SwitchParameter + + + + + + ServerName + + The name of the Azure SQL Server to remove. + + String + + String + + + none + + + Force + + Skip confirmation message and remove the Azure SQL Server. + + SwitchParameter + + SwitchParameter + + + none + + + ResourceGroupName + + The name of the resource group that contains the Azure SQL Server to remove. + + String + + String + + + none + + + Profile + + In-memory profile. + + AzureProfile + + AzureProfile + + + none + + + WhatIf + + + + SwitchParameter + + SwitchParameter + + + + + + Confirm + + + + SwitchParameter + + SwitchParameter + + + + + + + + + InputType + + + + + System.String + + + + + + + OutputType + + + + + System.Object + + + + + + + + + This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters. + + + + + + + + Remove-AzureSqlServerFirewallRule @@ -8957,6 +9254,164 @@ Switch-AzureMode –Name AzureResourceManager + + + Set-AzureSqlServerActiveDirectoryAdministrator + + Provisions an Azure Active Directory administrator for Azure SQL Server in the current subscription. + + + + + Set + AzureSqlServer + + + + Note: This cmdlet can only be executed in Azure Resource Manager mode. To enable Azure Resource Manager mode run the following command: +Switch-AzureMode –Name AzureResourceManager + For more information, see Using Windows PowerShell with Resource Manager. + + + + Set-AzureSqlServerActiveDirectoryAdministrator + + DisplayName + + + + String + + + ObjectId + + + + Guid + + + ServerName + + + + String + + + ResourceGroupName + + + + String + + + Profile + + + + AzureProfile + + + + + + DisplayName + + + + String + + String + + + + + + ObjectId + + + + Guid + + Guid + + + + + + ServerName + + + + String + + String + + + + + + ResourceGroupName + + + + String + + String + + + + + + Profile + + + + AzureProfile + + AzureProfile + + + + + + + + + InputType + + + + + System.String + + + + + + + OutputType + + + + + System.Object + + + + + + + + + This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters. + + + + + + + + Set-AzureSqlServerFirewallRule diff --git a/src/ResourceManager/Sql/Commands.Sql/Properties/Resources.Designer.cs b/src/ResourceManager/Sql/Commands.Sql/Properties/Resources.Designer.cs index 06120385f9c3..8833ba027e43 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Properties/Resources.Designer.cs +++ b/src/ResourceManager/Sql/Commands.Sql/Properties/Resources.Designer.cs @@ -60,6 +60,33 @@ internal Resources() { } } + /// + /// Looks up a localized string similar to More than one Active Directory group with the display name '{0}' was found. Please provide an object id to select the correct group.. + /// + internal static string ADGroupMoreThanOneFound { + get { + return ResourceManager.GetString("ADGroupMoreThanOneFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find the Azure Active Directory object '{0}'. Please make sure that the user or application service principal you are authorizing is registered in the current subscription's Azure Active directory.. + /// + internal static string ADObjectNotFound { + get { + return ResourceManager.GetString("ADObjectNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to More than one Azure Active Directory user with the display name '{0}' was found. Please provide an object id to select the correct user.. + /// + internal static string ADUserMoreThanOneFound { + get { + return ResourceManager.GetString("ADUserMoreThanOneFound", resourceCulture); + } + } + /// /// Looks up a localized string similar to Database with name: '{0}' already exists in server '{1}'.. /// @@ -168,6 +195,15 @@ internal static string InvalidRetentionTypeSet { } } + /// + /// Looks up a localized string similar to Please set a valid tenant id in the AzureEnvironment.. + /// + internal static string InvalidTenantId { + get { + return ResourceManager.GetString("InvalidTenantId", resourceCulture); + } + } + /// /// Looks up a localized string similar to A data masking rule with the id '{0}' already exist. /// @@ -249,6 +285,24 @@ internal static string RemoveAzureSqlDatabaseWarning { } } + /// + /// Looks up a localized string similar to Removing Azure Sql Server Active Directory Administrator on server '{0}'.. + /// + internal static string RemoveAzureSqlServerActiveDirectoryAdministratorDescription { + get { + return ResourceManager.GetString("RemoveAzureSqlServerActiveDirectoryAdministratorDescription", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove the Azure Sql Server Active Directory Administrator on server '{0}'?. + /// + internal static string RemoveAzureSqlServerActiveDirectoryAdministratorWarning { + get { + return ResourceManager.GetString("RemoveAzureSqlServerActiveDirectoryAdministratorWarning", resourceCulture); + } + } + /// /// Looks up a localized string similar to Permanently removing Azure Sql Database Server '{0}'.. /// diff --git a/src/ResourceManager/Sql/Commands.Sql/Properties/Resources.resx b/src/ResourceManager/Sql/Commands.Sql/Properties/Resources.resx index a9acdfeaee68..62ed6c78604c 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Properties/Resources.resx +++ b/src/ResourceManager/Sql/Commands.Sql/Properties/Resources.resx @@ -231,4 +231,22 @@ Auditing cannot be enabled . Upgrade to Basic, Standard or Premium Service Tier to enable auditing on your database(s) + + More than one Active Directory group with the display name '{0}' was found. Please provide an object id to select the correct group. + + + Cannot find the Azure Active Directory object '{0}'. Please make sure that the user or application service principal you are authorizing is registered in the current subscription's Azure Active directory. + + + More than one Azure Active Directory user with the display name '{0}' was found. Please provide an object id to select the correct user. + + + Please set a valid tenant id in the AzureEnvironment. + + + Removing Azure Sql Server Active Directory Administrator on server '{0}'. + + + Are you sure you want to remove the Azure Sql Server Active Directory Administrator on server '{0}'? + \ No newline at end of file diff --git a/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/AzureSqlServerActiveDirectoryAdministratorCmdletBase.cs b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/AzureSqlServerActiveDirectoryAdministratorCmdletBase.cs new file mode 100644 index 000000000000..0b0b49b058e0 --- /dev/null +++ b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/AzureSqlServerActiveDirectoryAdministratorCmdletBase.cs @@ -0,0 +1,46 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Management.Automation; +using Microsoft.Azure.Commands.Sql.Common; +using Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Model; +using Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Services; + +namespace Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Cmdlet +{ + public abstract class AzureSqlServerActiveDirectoryAdministratorCmdletBase : AzureSqlCmdletBase, AzureSqlServerActiveDirectoryAdministratorAdapter> + { + /// + /// Gets or sets the name of the Azure SQL Server that contains the Azure Active Directory administrator. + /// + [Parameter(Mandatory = true, + ValueFromPipelineByPropertyName = true, + Position = 1, + HelpMessage = "The name of the Azure SQL Server the Azure Active Directory administrator is in.")] + [ValidateNotNullOrEmpty] + public string ServerName { get; set; } + + /// + /// Initializes the adapter + /// + /// + /// + protected override AzureSqlServerActiveDirectoryAdministratorAdapter InitModelAdapter(Azure.Common.Authentication.Models.AzureSubscription subscription) + { + return new AzureSqlServerActiveDirectoryAdministratorAdapter(Profile, subscription); + } + } +} diff --git a/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/GetAzureSqlServerActiveDirectoryAdministrator.cs b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/GetAzureSqlServerActiveDirectoryAdministrator.cs new file mode 100644 index 000000000000..2910d4eab455 --- /dev/null +++ b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/GetAzureSqlServerActiveDirectoryAdministrator.cs @@ -0,0 +1,58 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System.Collections.Generic; +using System.Management.Automation; +using Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Model; + +namespace Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Cmdlet +{ + [Cmdlet(VerbsCommon.Get, "AzureSqlServerActiveDirectoryAdministrator", + ConfirmImpact = ConfirmImpact.None)] + public class GetAzureSqlServerActiveDirectoryAdministrator : AzureSqlServerActiveDirectoryAdministratorCmdletBase + { + /// + /// Get the entities from the service + /// + /// The list of entities + protected override IEnumerable GetEntity() + { + ICollection results; + + results = ModelAdapter.ListServerActiveDirectoryAdministrators(this.ResourceGroupName, this.ServerName); + + return results; + } + + /// + /// No user input to apply to model + /// + /// Model retrieved from service + /// The model that was passed in + protected override IEnumerable ApplyUserInputToModel(IEnumerable model) + { + return model; + } + + /// + /// No changes to persist to server + /// + /// The output of apply user input to model + /// The input entity + protected override IEnumerable PersistChanges(IEnumerable entity) + { + return entity; + } + } +} diff --git a/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/RemoveAzureSqlServerActiveDirectoryAdministrator.cs b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/RemoveAzureSqlServerActiveDirectoryAdministrator.cs new file mode 100644 index 000000000000..8fe7b29b198b --- /dev/null +++ b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/RemoveAzureSqlServerActiveDirectoryAdministrator.cs @@ -0,0 +1,82 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System.Collections.Generic; +using System.Globalization; +using System.Management.Automation; +using Microsoft.Azure.Commands.Sql.Properties; +using Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Model; + +namespace Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Cmdlet +{ + [Cmdlet(VerbsCommon.Remove, "AzureSqlServerActiveDirectoryAdministrator", + SupportsShouldProcess = true, + ConfirmImpact = ConfirmImpact.High)] + public class RemoveAzureSqlServerActiveDirectoryAdministrator : AzureSqlServerActiveDirectoryAdministratorCmdletBase + { + /// + /// Defines whether it is ok to skip the requesting of rule removal confirmation + /// + [Parameter(HelpMessage = "Skip confirmation message for performing the action")] + public SwitchParameter Force { get; set; } + + /// + /// Get the entities from the service + /// + /// The list of entities + protected override IEnumerable GetEntity() + { + return new List() { + ModelAdapter.GetServerActiveDirectoryAdministrator(this.ResourceGroupName, this.ServerName) + }; + } + + /// + /// No user input to apply to model + /// + /// Model retrieved from service + /// The model that was passed in + protected override IEnumerable ApplyUserInputToModel(IEnumerable model) + { + return model; + } + + /// + /// No changes to persist to server + /// + /// The output of apply user input to model + /// The input entity + protected override IEnumerable PersistChanges(IEnumerable entity) + { + ModelAdapter.RemoveServerActiveDirectoryAdministrator(this.ResourceGroupName, this.ServerName); + return entity; + } + + /// + /// Entry point for the cmdlet + /// + public override void ExecuteCmdlet() + { + if (!Force.IsPresent && !ShouldProcess( + string.Format(CultureInfo.InvariantCulture, Resources.RemoveAzureSqlServerActiveDirectoryAdministratorDescription, this.ServerName), + string.Format(CultureInfo.InvariantCulture, Resources.RemoveAzureSqlServerActiveDirectoryAdministratorWarning, this.ServerName), + Resources.ShouldProcessCaption)) + { + return; + } + + base.ExecuteCmdlet(); + } + } +} diff --git a/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/SetAzureSqlServerActiveDirectoryAdministrator.cs b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/SetAzureSqlServerActiveDirectoryAdministrator.cs new file mode 100644 index 000000000000..3f8d888f7e9d --- /dev/null +++ b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Cmdlet/SetAzureSqlServerActiveDirectoryAdministrator.cs @@ -0,0 +1,107 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using Hyak.Common; +using Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Model; + +namespace Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Cmdlet +{ + /// + /// Cmdlet to create a new Azure SQL Server Active Directory administrator + /// + [Cmdlet(VerbsCommon.Set, "AzureSqlServerActiveDirectoryAdministrator", + ConfirmImpact = ConfirmImpact.Medium)] + public class SetAzureSqlServerActiveDirectoryAdministrator : AzureSqlServerActiveDirectoryAdministratorCmdletBase + { + /// + /// Azure Active Directory display name for a user or group + /// + [Parameter(Mandatory = true, + ValueFromPipelineByPropertyName = true, + Position = 2, + HelpMessage = "Specifies the display name of the user or group for whom to grant permissions. This display name must exist in the active directory associated with the current subscription.")] + [ValidateNotNullOrEmpty()] + public string DisplayName { get; set; } + + /// + /// Azure Active Directory object id for a user or group + /// + [Parameter(Mandatory = false, + ValueFromPipelineByPropertyName = true, + Position = 3, + HelpMessage = "Specifies the object ID of the user or group in Azure Active Directory for which to grant permissions.")] + [ValidateNotNullOrEmpty()] + public Guid ObjectId { get; set; } + + /// + /// Get the entities from the service + /// + /// The list of entities + protected override IEnumerable GetEntity() + { + List currentActiveDirectoryAdmins = null; + try + { + currentActiveDirectoryAdmins = new List() + { + ModelAdapter.GetServerActiveDirectoryAdministrator(this.ResourceGroupName, this.ServerName), + }; + } + catch(CloudException ex) + { + if(ex.Response.StatusCode != System.Net.HttpStatusCode.NotFound) + { + // Unexpected exception encountered + throw; + } + } + + return currentActiveDirectoryAdmins; + } + + /// + /// Create the list of models from a list of user input + /// + /// A IEnumerable of models retrieved from service + /// A list of models that was passed in + protected override IEnumerable ApplyUserInputToModel(IEnumerable model) + { + List newEntity = new List(); + newEntity.Add(new AzureSqlServerActiveDirectoryAdministratorModel() + { + ResourceGroupName = ResourceGroupName, + ServerName = ServerName, + DisplayName = DisplayName, + ObjectId = ObjectId, + }); + return newEntity; + } + + /// + /// Update the Azure SQL Server Active Directory administrator + /// + /// A list of models to update the list + /// A list of the persisted entities + protected override IEnumerable PersistChanges(IEnumerable entity) + { + return new List() { + ModelAdapter.UpsertServerActiveDirectoryAdministrator(this.ResourceGroupName, this.ServerName, entity.First()) + }; + } + } +} diff --git a/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Model/AzureSqlServerActiveDirectoryAdministratorModel.cs b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Model/AzureSqlServerActiveDirectoryAdministratorModel.cs new file mode 100644 index 000000000000..29d6fdb13ce0 --- /dev/null +++ b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Model/AzureSqlServerActiveDirectoryAdministratorModel.cs @@ -0,0 +1,45 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Model +{ + /// + /// Represents an Azure SQL Server Active Directory administrator + /// + public class AzureSqlServerActiveDirectoryAdministratorModel + { + /// + /// Gets or sets the name of the resource group + /// + public string ResourceGroupName { get; set; } + + /// + /// Gets or sets the name of the server + /// + public string ServerName { get; set; } + + /// + /// Gets or sets the name of the Azure SQL Server Active Directory administrator display name + /// + public string DisplayName { get; set; } + + /// + /// Gets or sets the unique ID of the Azure SQL Server Active administrator admin object id + /// + public Guid ObjectId { get; set; } + } +} diff --git a/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Services/AzureSqlServerActiveDirectoryAdministratorAdapter.cs b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Services/AzureSqlServerActiveDirectoryAdministratorAdapter.cs new file mode 100644 index 000000000000..ee7dabb2dd61 --- /dev/null +++ b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Services/AzureSqlServerActiveDirectoryAdministratorAdapter.cs @@ -0,0 +1,258 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +extern alias MicrosoftAzureCommandsResources; + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using Microsoft.Azure.Commands.Sql.Common; +using Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Model; +using Microsoft.Azure.Commands.Sql.Properties; +using Microsoft.Azure.Commands.Sql.Server.Adapter; +using Microsoft.Azure.Commands.Sql.Services; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Management.Sql; +using Microsoft.Azure.Management.Sql.Models; +using MicrosoftAzureCommandsResourcesModelsActiveDirectory = MicrosoftAzureCommandsResources::Microsoft.Azure.Commands.Resources.Models.ActiveDirectory; +using Microsoft.Azure.Common.Authentication; + +namespace Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Services +{ + /// + /// Adapter for Azure SQL Server Active Directory administrator operations + /// + public class AzureSqlServerActiveDirectoryAdministratorAdapter + { + /// + /// Gets or sets the AzureSqlServerActiveDirectoryAdministratorCommunicator which has all the needed management clients + /// + private AzureSqlServerActiveDirectoryAdministratorCommunicator Communicator { get; set; } + + /// + /// Gets or sets the Azure profile + /// + public AzureProfile Profile { get; set; } + + /// + /// Gets or sets the Azure Subscription + /// + private AzureSubscription _subscription { get; set; } + + /// + /// A private instance of ActiveDirectoryClient + /// + private MicrosoftAzureCommandsResourcesModelsActiveDirectory.ActiveDirectoryClient _activeDirectoryClient; + + /// + /// Gets or sets the Azure ActiveDirectoryClient instance + /// + public MicrosoftAzureCommandsResourcesModelsActiveDirectory.ActiveDirectoryClient ActiveDirectoryClient + { + get + { + if (_activeDirectoryClient == null) + { + _activeDirectoryClient = new MicrosoftAzureCommandsResourcesModelsActiveDirectory.ActiveDirectoryClient(Profile.Context); + } + return this._activeDirectoryClient; + } + + set { this._activeDirectoryClient = value; } + } + + /// + /// Constructs a Azure SQL Server Active Directory administrator adapter + /// + /// The current azure profile + /// The current azure subscription + public AzureSqlServerActiveDirectoryAdministratorAdapter(AzureProfile Profile, AzureSubscription subscription) + { + this.Profile = Profile; + this._subscription = subscription; + Communicator = new AzureSqlServerActiveDirectoryAdministratorCommunicator(Profile, subscription); + } + + /// + /// Gets an Azure SQL Server Active Directory administrator by name. + /// + /// The name of the resource group + /// The name of the Azure SQL Server that contains the Azure Active Directory administrator + /// The Azure Sql ServerActiveDirectoryAdministrator object + internal AzureSqlServerActiveDirectoryAdministratorModel GetServerActiveDirectoryAdministrator(string resourceGroupName, string serverName) + { + var resp = Communicator.Get(resourceGroupName, serverName, Util.GenerateTracingId()); + return CreateServerActiveDirectoryAdministratorModelFromResponse(resourceGroupName, serverName, resp); + } + + /// + /// Gets a list of Azure SQL Server Active Directory administrators. + /// + /// The name of the resource group + /// The name of the Azure SQL Server that contains the Azure Active Directory administrator + /// A list of Azure SQL Server Active Directory administrators objects + internal ICollection ListServerActiveDirectoryAdministrators(string resourceGroupName, string serverName) + { + var resp = Communicator.List(resourceGroupName, serverName, Util.GenerateTracingId()); + + return resp.Select((activeDirectoryAdmin) => + { + return CreateServerActiveDirectoryAdministratorModelFromResponse(resourceGroupName, serverName, activeDirectoryAdmin); + }).ToList(); + } + + /// + /// Creates or updates an Azure SQL Server Active Directory administrator. + /// + /// The name of the resource group + /// The name of the Azure Sql ServerActiveDirectoryAdministrator Server + /// The input parameters for the create/update operation + /// The upserted Azure SQL Server Active Directory administrator + internal AzureSqlServerActiveDirectoryAdministratorModel UpsertServerActiveDirectoryAdministrator(string resourceGroup, string serverName, AzureSqlServerActiveDirectoryAdministratorModel model) + { + var resp = Communicator.CreateOrUpdate(resourceGroup, serverName, Util.GenerateTracingId(), new ServerAdministratorCreateOrUpdateParameters() + { + Properties = GetActiveDirectoryInformation(model.DisplayName, model.ObjectId) + }); + + return CreateServerActiveDirectoryAdministratorModelFromResponse(resourceGroup, serverName, resp); + } + + /// + /// Deletes a Azure SQL Server Active Directory administrator + /// + /// The resource group the server is in + /// The name of the Azure Sql ServerActiveDirectoryAdministrator Server + public void RemoveServerActiveDirectoryAdministrator(string resourceGroupName, string serverName) + { + Communicator.Remove(resourceGroupName, serverName, Util.GenerateTracingId()); + } + + /// + /// Converts the response from the service to a powershell database object + /// + /// The resource group the server is in + /// The name of the Azure Sql ServerActiveDirectoryAdministrator Server + /// The service response + /// The converted model + public static AzureSqlServerActiveDirectoryAdministratorModel CreateServerActiveDirectoryAdministratorModelFromResponse(string resourceGroup, string serverName, Management.Sql.Models.ServerAdministrator admin) + { + AzureSqlServerActiveDirectoryAdministratorModel model = new AzureSqlServerActiveDirectoryAdministratorModel(); + + model.ResourceGroupName = resourceGroup; + model.ServerName = serverName; + model.DisplayName = admin.Properties.Login; + model.ObjectId = admin.Properties.Sid; + + return model; + } + + /// + /// Verifies that the Azure Active Directory user or group exists, and will get the object id if it is not set. + /// + /// Azure Active Directory user or group display name + /// Azure Active Directory user or group object id + /// + protected ServerAdministratorCreateOrUpdateProperties GetActiveDirectoryInformation(string displayName, Guid objectId) + { + // Gets the default Tenant id for the subscriptions + Guid tenantId = GetTenantId(); + + // Check for a Azure Active Directory group. Recommended to always use group. + IEnumerable groupList = null; + + var filter = new MicrosoftAzureCommandsResourcesModelsActiveDirectory.ADObjectFilterOptions() + { + Id = (objectId != null && objectId != Guid.Empty) ? objectId.ToString() : null, + SearchString = displayName, + Paging = true, + }; + + // Get a list of groups from Azure Active Directory + groupList = ActiveDirectoryClient.FilterGroups(filter).Where(gr => string.Equals(gr.DisplayName, displayName, StringComparison.OrdinalIgnoreCase)); + + if (groupList.Count() > 1) + { + // More than one group was found with that display name. + throw new ArgumentException(string.Format(Resources.ADGroupMoreThanOneFound, displayName)); + } + else if (groupList.Count() == 1) + { + // Only one group was found. Get the group display name and object id + var group = groupList.First(); + return new ServerAdministratorCreateOrUpdateProperties() + { + Login = group.DisplayName, + Sid = group.Id, + TenantId = tenantId, + }; + } + + // No group was found. Check for a user + filter = new MicrosoftAzureCommandsResourcesModelsActiveDirectory.ADObjectFilterOptions() + { + Id = (objectId != null && objectId != Guid.Empty) ? objectId.ToString() : null, + SearchString = displayName, + Paging = true, + }; + + // Get a list of user from Azure Active Directory + var userList = ActiveDirectoryClient.FilterUsers(filter).Where(gr => string.Equals(gr.DisplayName, displayName, StringComparison.OrdinalIgnoreCase)); + + // No user was found + if (userList == null || userList.Count() == 0) + { + throw new ArgumentException(string.Format(Resources.ADObjectNotFound, displayName)); + } + else if (userList.Count() > 1) + { + // More than one user was found. + throw new ArgumentException(string.Format(Resources.ADUserMoreThanOneFound, displayName)); + } + else + { + // Only one user was found. Get the user display name and object id + var obj = userList.First(); + + return new ServerAdministratorCreateOrUpdateProperties() + { + Login = obj.DisplayName, + Sid = obj.Id, + TenantId = tenantId, + }; + } + } + + /// + /// Get the default tenantId for the current subscription + /// + /// + protected Guid GetTenantId() + { + var tenantIdStr = + Profile.Context.Subscription.GetPropertyAsArray(AzureSubscription.Property.Tenants).FirstOrDefault(); + string adTenant = Profile.Context.Environment.GetEndpoint(AzureEnvironment.Endpoint.AdTenant); + string graph = Profile.Context.Environment.GetEndpoint(AzureEnvironment.Endpoint.Graph); + var tenantIdGuid = Guid.Empty; + + if (string.IsNullOrWhiteSpace(tenantIdStr) || !Guid.TryParse(tenantIdStr, out tenantIdGuid)) + { + throw new InvalidOperationException(Resources.InvalidTenantId); + } + + return tenantIdGuid; + } + } +} diff --git a/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Services/AzureSqlServerActiveDirectoryAdministratorCommunicator.cs b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Services/AzureSqlServerActiveDirectoryAdministratorCommunicator.cs new file mode 100644 index 000000000000..1c39ebc5fef1 --- /dev/null +++ b/src/ResourceManager/Sql/Commands.Sql/ServerActiveDirectoryAdministrator/Services/AzureSqlServerActiveDirectoryAdministratorCommunicator.cs @@ -0,0 +1,123 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using Microsoft.Azure.Commands.Sql.Common; +using Microsoft.Azure.Common.Authentication; +using Microsoft.Azure.Common.Authentication.Models; +using Microsoft.Azure.Management.Resources; +using Microsoft.Azure.Management.Sql; +using Microsoft.Azure.Management.Sql.Models; +using Microsoft.WindowsAzure.Management.Storage; + +namespace Microsoft.Azure.Commands.Sql.ServerActiveDirectoryAdministrator.Services +{ + /// + /// This class is responsible for all the REST communication with the audit REST endpoints + /// + public class AzureSqlServerActiveDirectoryAdministratorCommunicator + { + /// + /// The Sql client to be used by this end points communicator + /// + private static SqlManagementClient SqlClient { get; set; } + + /// + /// The Sql client default name for the active directory admin + /// + private static string ActiveDirectoryDefaultName { get { return "ActiveDirectory"; } } + + /// + /// The Sql client default type for the active directory admin + /// + private static string ActiveDirectoryDefaultType { get { return "activeDirectory"; } } + + /// + /// Gets or set the Azure subscription + /// + private static AzureSubscription Subscription {get ; set; } + + /// + /// Gets or sets the Azure profile + /// + public AzureProfile Profile { get; set; } + + /// + /// Creates a communicator for Azure SQL Server Active Directory administrator + /// + /// + /// + public AzureSqlServerActiveDirectoryAdministratorCommunicator(AzureProfile profile, AzureSubscription subscription) + { + Profile = profile; + if (subscription != Subscription) + { + Subscription = subscription; + SqlClient = null; + } + } + + /// + /// Gets the Azure SQL Server Active Directory administrator + /// + public Management.Sql.Models.ServerAdministrator Get(string resourceGroupName, string serverName, string clientRequestId) + { + return GetCurrentSqlClient(clientRequestId).ServerAdministrators.Get(resourceGroupName, serverName, ActiveDirectoryDefaultName).Administrator; + } + + /// + /// Lists Azure SQL Server Active Directory administrators + /// + public IList List(string resourceGroupName, string serverName, string clientRequestId) + { + return GetCurrentSqlClient(clientRequestId).ServerAdministrators.List(resourceGroupName, serverName).Administrators; + } + + /// + /// Creates or updates a Azure SQL Server Active Directory Administrator + /// + public Management.Sql.Models.ServerAdministrator CreateOrUpdate(string resourceGroupName, string serverName, string clientRequestId, ServerAdministratorCreateOrUpdateParameters parameters) + { + // Always set the type to active directory + parameters.Properties.AdministratorType = ActiveDirectoryDefaultType; + return GetCurrentSqlClient(clientRequestId).ServerAdministrators.CreateOrUpdate(resourceGroupName, serverName, ActiveDirectoryDefaultName, parameters).ServerAdministrator; + } + + /// + /// Deletes a Azure SQL Server Active Directory Administrator + /// + public void Remove(string resourceGroupName, string serverName, string clientRequestId) + { + GetCurrentSqlClient(clientRequestId).ServerAdministrators.Delete(resourceGroupName, serverName, ActiveDirectoryDefaultName); + } + + /// + /// Retrieve the SQL Management client for the currently selected subscription, adding the session and request + /// id tracing headers for the current cmdlet invocation. + /// + /// The SQL Management client for the currently selected subscription. + private SqlManagementClient GetCurrentSqlClient(String clientRequestId) + { + // Get the SQL management client for the current subscription + if (SqlClient == null) + { + SqlClient = AzureSession.ClientFactory.CreateClient(Profile, Subscription, AzureEnvironment.Endpoint.ResourceManager); + } + SqlClient.HttpClient.DefaultRequestHeaders.Remove(Constants.ClientRequestIdHeaderName); + SqlClient.HttpClient.DefaultRequestHeaders.Add(Constants.ClientRequestIdHeaderName, clientRequestId); + return SqlClient; + } + } +} \ No newline at end of file diff --git a/src/ResourceManager/Sql/Commands.Sql/packages.config b/src/ResourceManager/Sql/Commands.Sql/packages.config index 9867c87f0005..db6190a4d37d 100644 --- a/src/ResourceManager/Sql/Commands.Sql/packages.config +++ b/src/ResourceManager/Sql/Commands.Sql/packages.config @@ -5,7 +5,7 @@ - +