-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Adding support for Private DNS zones Public Preview #5701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding support for Private DNS zones Public Preview #5701
Conversation
|
@muwaqar Do you have cmdlet review associated with this PR? If not, please fill out a review here: https://github.com/Azure/azure-powershell-cmdlet-review-pr. Once this is approved, we will proceed with the PR review. |
|
The design review can be found at https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/22 |
|
@muwaqar To be able to properly build without a published nuget package, you will need to put your unpublished nuget package here: https://github.com/Azure/azure-powershell/tree/preview/tools/LocalFeed |
|
@maddieclayton : We are waiting for the Swagger and .NET SDK PRs to complete (mentioned in the description). Once they get merged, I will push another commit here with the final .NET SDK version. |
|
@maddieclayton what's the status of this PR? |
|
@cormacpayne Still waiting for SDK to be merged and published. @muwaqar please assign this to me once the SDK is published and the PR is updated. |
|
@maddieclayton : I generated the MSI (https://azuresdkci.westus2.cloudapp.azure.com/view/PowerShell/job/posh-pack/52/). Now, because of |
|
@muwaqar we don't want to have cross-module dependencies -- in this case, we have a |
| </Reference> | ||
| <Reference Include="Microsoft.Azure.Management.Network, Version=17.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
| <SpecificVersion>False</SpecificVersion> | ||
| <HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.17.0.0-preview\lib\net452\Microsoft.Azure.Management.Network.dll</HintPath> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add your new test here - follow the structure of the other json files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get this. Can you clarify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at line 240 in this file, and create a new entry for each of your new json files generated for new tests, and add a line so that each of them is copied to the output directory.
| function TestSetup-CreateVirtualNetwork($resourceGroup) | ||
| { | ||
| $virtualNetworkName = Get-VirtualNetworkName | ||
| $location = Get-ProviderLocation "microsoft.network" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to do the full provider name/resource type i.e. "microsoft.network/virtualnetwork" (I don't know that that is the correct resource type).
| Assert-AreEqual 1 $createdZone.NumberOfRecordSets | ||
| Assert-AreNotEqual $createdZone.NumberOfRecordSets $createdZone.MaxNumberOfRecordSets | ||
| Assert-AreEqual Private $createdZone.ZoneType | ||
| Assert-AreEqual 1 $createdZone.RegistrationVirtualNetworkIds.Count |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to check the actual value of the ids here.
| @@ -115,6 +121,10 @@ | |||
| <Project>{3819d8a7-c62c-4c47-8ddd-0332d9ce1252}</Project> | |||
| <Name>Commands.ResourceManager.Common</Name> | |||
| </ProjectReference> | |||
| <ProjectReference Include="..\..\Network\Commands.Network\Commands.Network.csproj"> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use this project instead:
azure-powershell/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj
Line 343 in 2001d50
| <ProjectReference Include="..\..\..\Common\Commands.Common.Network\Commands.Common.Network.csproj"> |
| @@ -0,0 +1,21 @@ | |||
| Param( | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this and where is it used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a helper file that we use to record the tests. Without it, it's very cumbersome to set it up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This setup method already exists and is described here: https://github.com/Azure/azure-powershell/blob/preview/documentation/testing-docs/using-azure-test-framework.md. Please remove this ps1 file.
| using ProjectResources = Microsoft.Azure.Commands.Dns.Properties.Resources; | ||
|
|
||
| namespace Microsoft.Azure.Commands.Dns | ||
| { | ||
| using System.Linq; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move these above
| @@ -35,10 +43,30 @@ public class NewAzureDnsZone : DnsBaseCmdlet | |||
| [ValidateNotNullOrEmpty] | |||
| public string ResourceGroupName { get; set; } | |||
|
|
|||
| [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The type of the zone, Public or Private. This property cannot be changed for a zone.")] | |||
| [ValidateNotNullOrEmpty] | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a validateset here if the only optional allow are public and private.
| Etag = "*", | ||
| Tags = this.Tag, | ||
| }; | ||
| this.Name = this.Name.TrimEnd('.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this have previously caused the cmdlet to fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check was already present in the file, on line 76.
| @@ -1087,3 +1087,11 @@ | |||
| "Microsoft.Azure.Commands.AnalysisServices.dll","Microsoft.Azure.Commands.AnalysisServices.NewAzureRmAnalysisServicesFirewallRule","New-AzureRmAnalysisServicesFirewallRule","1","8100","New-AzureRmAnalysisServicesFirewallRule Does not support ShouldProcess but the cmdlet verb New indicates that it should.","Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue" | |||
| "Microsoft.Azure.Commands.AnalysisServices.dll","Microsoft.Azure.Commands.AnalysisServices.NewAzureRmAnalysisServicesFirewallConfig","New-AzureRmAnalysisServicesFirewallConfig","1","8100","New-AzureRmAnalysisServicesFirewallConfig Does not support ShouldProcess but the cmdlet verb New indicates that it should.","Determine if the cmdlet should implement ShouldProcess and if so determine if it should implement Force / ShouldContinue" | |||
| "Microsoft.WindowsAzure.Commands.Storage.dll","Microsoft.WindowsAzure.Commands.Storage.Common.Cmdlet.EnableAzureStorageServiceDeleteRetentionPolicyCommand","Enable-AzureStorageDeleteRetentionPolicy","1","8410","Parameter RetentionDays of cmdlet Enable-AzureStorageDeleteRetentionPolicy does not follow the enforced naming convention of using a singular noun for a parameter name.","Consider using a singular noun for the parameter name." | |||
| "Microsoft.Azure.Commands.Dns.dll","Microsoft.Azure.Commands.Dns.SetAzureDnsZone","Set-AzureRmDnsZone","1","8410","Parameter RegistrationVirtualNetworkIds of cmdlet Set-AzureRmDnsZone does not follow the enforced naming convention of using a singular noun for a parameter name.","Consider using a singular noun for the parameter name." | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change all of the "VirtualNetworkIds" to "VirtualNetworkId" and all of the "VirtualNetworks" to "VirtualNetwork". This is a powershell standard. Once you do that you can remove these lines from SignatureIssues.
|
@muwaqar Besides the Network issue, this PR looks good to me. |
cormacpayne
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@muwaqar a few comments. Also, I might have missed this in discussion, but when is the SDK being published to NuGet? This needs to happen before we can merge this PR
|
|
||
| # Assemblies that must be loaded prior to importing this module | ||
| RequiredAssemblies = '.\Microsoft.Azure.Management.Dns.dll' | ||
| RequiredAssemblies = '.\Microsoft.Azure.Management.Dns.dll', '.\Microsoft.Azure.Commands.Network.dll' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@muwaqar this reference to Microsoft.Azure.Commands.Network.dll can be removed
| <HintPath>..\..\..\packages\Microsoft.Azure.Management.Dns.2.2.0-preview\lib\net452\Microsoft.Azure.Management.Dns.dll</HintPath> | ||
| <Private>True</Private> | ||
| </Reference> | ||
| <Reference Include="Microsoft.Azure.Management.Network, Version=17.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@muwaqar if your test project is going to depend on the Network SDK, then you should update the Network entry in the TestMappings.json file with a reference to the Dns test project so these tests get run whenever a change in Network is made
| <HintPath>..\..\..\packages\Microsoft.Azure.Management.Dns.2.0.0-preview\lib\net452\Microsoft.Azure.Management.Dns.dll</HintPath> | ||
| <HintPath>..\..\..\packages\Microsoft.Azure.Management.Dns.2.2.0-preview\lib\net452\Microsoft.Azure.Management.Dns.dll</HintPath> | ||
| </Reference> | ||
| <Reference Include="Microsoft.Azure.Management.Network, Version=17.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@muwaqar this reference shouldn't be needed anymore, right?
| using Microsoft.Azure.Management.Internal.Network.Common; | ||
| using Newtonsoft.Json; | ||
|
|
||
| public class PSVirtualNetwork : PSTopLevelResource, IResourceReference |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@muwaqar since we're making changes in the Network module, we will need to release a new version of their module along with Dns so users are able to access this updated type. Our mechanism for determining if a module has been updated or not is an entry in the change log, so you will need to update the Network change log with a short snippet about updating model types for compatibility with Dns cmdlets.
|
@cormacpayne: Fixed the issues for which you posted comments. |
src/ResourceManager/Dns/Dns.sln
Outdated
| @@ -36,6 +36,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Network", " | |||
| EndProject | |||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common.Storage", "..\..\Common\Commands.Common.Storage\Commands.Common.Storage.csproj", "{65C3A86A-716D-4E7D-AB67-1DB00B3BF72D}" | |||
| EndProject | |||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Network", "..\Network\Commands.Network\Commands.Network.csproj", "{98CFD96B-A6BC-4F15-AE2C-603FC2B58981}" | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@muwaqar you should include the Commands.Common.Network project in this solution as well so it gets built with your solution. Also, do you need to build Commands.Network with this solution, or can we remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commands.Common.Network is already part of this solution.
|
@maddieclayton @cormacpayne : I have updated PR with published .NET SDK nuget. The build seems to be failing due to some unrelated issue. Please re-queue the build, and if you don't have any further comments, please merge it at your earliest convenience. |
|
On-demand: https://azuresdkci.westus2.cloudapp.azure.com/job/powershell-demand/606/ (and 607 and 608) |
Description
This PR is loosely based on https://github.com/Azure/azure-powershell-pr/pull/294 which was submitted when the Private DNS zones feature was launched in a private preview. The PR keeps most of the changes.
It is built on top of 2018-03-01-preview Swagger version (Azure/azure-rest-api-specs#2587) and version 2.2.0-preview of the .NET SDK (Azure/azure-sdk-for-net#4109). These changes are not merged/live yet, so this PR is just to initiate the design review and get an approval in principle. Once the pre-requisite changes have been merged, only then we plan to complete this PR.
The relevant cmdlet design review for this PR can be found at https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/22
Checklist
CONTRIBUTING.mdplatyPSmodule