Skip to content

Commit 627cf9c

Browse files
authored
Merge pull request #294 from karravi-msft/preview
Support for Private DNS zones in Azure DNS
2 parents 2db74e2 + 29122f5 commit 627cf9c

File tree

74 files changed

+50831
-4393
lines changed

Some content is hidden

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

74 files changed

+50831
-4393
lines changed

src/ResourceManager/Dns/ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21-
21+
* Support for Private DNS Zones (Public Preview feature)
22+
- Adds ability to create DNS Zones that are visible only within associated virtual networks
2223
## Version 3.3.1
2324

2425
## Version 3.3.0

src/ResourceManager/Dns/Commands.Dns.Test/Commands.Dns.Test.csproj

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@
6363
</Reference>
6464
<Reference Include="Microsoft.Azure.Management.Dns, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6565
<SpecificVersion>False</SpecificVersion>
66-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Dns.1.7.2-preview\lib\net45\Microsoft.Azure.Management.Dns.dll</HintPath>
66+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Dns.1.11.0-preview\lib\net452\Microsoft.Azure.Management.Dns.dll</HintPath>
67+
<Private>True</Private>
68+
</Reference>
69+
<Reference Include="Microsoft.Azure.Management.Network, Version=14.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
70+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.14.0.0-preview\lib\net452\Microsoft.Azure.Management.Network.dll</HintPath>
6771
<Private>True</Private>
6872
</Reference>
6973
<Reference Include="Microsoft.Azure.Management.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -104,7 +108,7 @@
104108
<Private>True</Private>
105109
</Reference>
106110
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.TestFramework">
107-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.5.0-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll</HintPath>
111+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.TestFramework.1.5.2\lib\net45\Microsoft.Rest.ClientRuntime.Azure.TestFramework.dll</HintPath>
108112
<Private>True</Private>
109113
</Reference>
110114
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -328,6 +332,12 @@
328332
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestZoneCrud.json">
329333
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
330334
</None>
335+
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestZoneCrudPrivateRegistrationVnet.json">
336+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
337+
</None>
338+
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestZoneCrudPrivateResolutionVnet.json">
339+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
340+
</None>
331341
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.DnsTests.ZoneTests\TestZoneCrudTrimsDot.json">
332342
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
333343
</None>

src/ResourceManager/Dns/Commands.Dns.Test/ScenarioTests/Common.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ function Get-ResourceGroupName
2121
return getAssetName
2222
}
2323

24+
<#
25+
.SYNOPSIS
26+
Gets valid resource group name
27+
#>
28+
function Get-VirtualNetworkName
29+
{
30+
return getAssetName
31+
}
32+
2433
<#
2534
.SYNOPSIS
2635
Gets valid resource name
@@ -71,6 +80,18 @@ function TestSetup-CreateResourceGroup
7180
return $resourceGroup
7281
}
7382

83+
<#
84+
.SYNOPSIS
85+
Creates a resource group to use in tests
86+
#>
87+
function TestSetup-CreateVirtualNetwork ($resourceGroup)
88+
{
89+
$virtualNetworkName = Get-VirtualNetworkName
90+
$virtualNetwork = New-AzureRmVirtualNetwork -Name $virtualNetworkName -resourceGroupName $resourceGroup.ResourceGroupName -location "WestUS" -AddressPrefix "192.168.1.0/24"
91+
return $virtualNetwork
92+
}
93+
94+
7495
function Get-RandomZoneName
7596
{
7697
$prefix = getAssetName;

src/ResourceManager/Dns/Commands.Dns.Test/ScenarioTests/DnsTestsBase.cs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
using System.Collections.Generic;
1616
using Microsoft.Azure.Commands.Common.Authentication;
17+
using Microsoft.Azure.Management.Network;
1718
using Microsoft.Azure.Test.HttpRecorder;
1819
using RestTestFramework = Microsoft.Rest.ClientRuntime.Azure.TestFramework;
1920

@@ -38,23 +39,19 @@ public class DnsTestsBase : RMTestBase
3839
{
3940
private LegacyTest.CSMTestEnvironmentFactory csmTestFactory;
4041

41-
4242
private readonly EnvironmentSetupHelper helper;
43-
44-
43+
4544
public ResourceManagementClient ResourceManagementClient { get; private set; }
4645

4746
public SubscriptionClient SubscriptionClient { get; private set; }
4847

49-
5048
public GalleryClient GalleryClient { get; private set; }
5149

52-
5350
public AuthorizationManagementClient AuthorizationManagementClient { get; private set; }
5451

55-
5652
public DnsManagementClient DnsClient { get; private set; }
5753

54+
public NetworkManagementClient NetworkManagementClient { get; private set; }
5855

5956
public static DnsTestsBase NewInstance
6057
{
@@ -64,28 +61,28 @@ public static DnsTestsBase NewInstance
6461
}
6562
}
6663

67-
6864
protected DnsTestsBase()
6965
{
7066
this.helper = new EnvironmentSetupHelper();
7167
}
7268

73-
7469
protected void SetupManagementClients(MockContext context)
7570
{
7671
this.ResourceManagementClient = this.GetResourceManagementClient();
7772
this.SubscriptionClient = this.GetSubscriptionClient();
7873
this.GalleryClient = this.GetGalleryClient();
7974
this.AuthorizationManagementClient = this.GetAuthorizationManagementClient();
80-
this.DnsClient = this.GetFeatureClient(context);
75+
this.DnsClient = this.GetFeatureClient(context);
76+
this.NetworkManagementClient = this.GetNetworkManagementClient(context);
8177

8278

8379
this.helper.SetupManagementClients(
8480
this.ResourceManagementClient,
8581
this.SubscriptionClient,
8682
this.GalleryClient,
8783
this.AuthorizationManagementClient,
88-
this.DnsClient);
84+
this.DnsClient,
85+
this.NetworkManagementClient);
8986
}
9087

9188

@@ -133,12 +130,15 @@ public void RunPsTestWorkflow(
133130
}
134131

135132

136-
this.SetupManagementClients(context);
137-
133+
this.SetupManagementClients(context);
138134

139135
this.helper.SetupEnvironment(AzureModule.AzureResourceManager);
140136

141137

138+
139+
140+
141+
142142
string callingClassName = callingClassType
143143
.Split(new[] { "." }, StringSplitOptions.RemoveEmptyEntries)
144144
.Last();
@@ -148,6 +148,7 @@ public void RunPsTestWorkflow(
148148
helper.RMProfileModule,
149149
helper.RMResourceModule,
150150
helper.GetRMModulePath("AzureRM.Dns.psd1"),
151+
helper.GetRMModulePath("AzureRM.Network.psd1"),
151152
"AzureRM.Resources.ps1");
152153

153154
try
@@ -178,6 +179,12 @@ protected ResourceManagementClient GetResourceManagementClient()
178179
return LegacyTest.TestBase.GetServiceClient<ResourceManagementClient>(this.csmTestFactory);
179180
}
180181

182+
protected NetworkManagementClient GetNetworkManagementClient(MockContext context)
183+
{
184+
return context.GetServiceClient<NetworkManagementClient>(TestEnvironmentFactory.GetTestEnvironment());
185+
}
186+
187+
181188
private AuthorizationManagementClient GetAuthorizationManagementClient()
182189
{
183190
return LegacyTest.TestBase.GetServiceClient<AuthorizationManagementClient>(this.csmTestFactory);

src/ResourceManager/Dns/Commands.Dns.Test/ScenarioTests/ZoneTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ public void TestZoneCrud()
3131
DnsTestsBase.NewInstance.RunPowerShellTest("Test-ZoneCrud");
3232
}
3333

34+
[Fact]
35+
[Trait(Category.AcceptanceType, Category.CheckIn)]
36+
public void TestZoneCrudPrivateResolutionVnet()
37+
{
38+
DnsTestsBase.NewInstance.RunPowerShellTest("Test-ZoneCrudPrivateResolutionVnet");
39+
}
40+
41+
[Fact]
42+
[Trait(Category.AcceptanceType, Category.CheckIn)]
43+
public void TestZoneCrudPrivateRegistrationVnet()
44+
{
45+
DnsTestsBase.NewInstance.RunPowerShellTest("Test-ZoneCrudPrivateRegistrationVnet");
46+
}
47+
3448
[Fact]
3549
[Trait(Category.AcceptanceType, Category.CheckIn)]
3650
public void TestZoneCrudTrimsDot()

0 commit comments

Comments
 (0)