Skip to content

Netcore + KeyVault #4879

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

Merged
merged 2 commits into from
Nov 30, 2017
Merged

Netcore + KeyVault #4879

merged 2 commits into from
Nov 30, 2017

Conversation

twitchax
Copy link
Contributor

@twitchax twitchax commented Oct 28, 2017

Description


This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.

General Guidelines

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.
  • The pull request does not introduce breaking changes (unless a major version change occurs in the assembly and module).

Testing Guidelines

  • Pull request includes test coverage for the included changes.
  • PowerShell scripts used in tests should do any necessary setup as part of the test or suite setup, and should not use hard-coded values for locations or existing resources.

Cmdlet Signature Guidelines

  • New cmdlets that make changes or have side effects should implement ShouldProcess and have SupportShouldProcess=true specified in the cmdlet attribute. You can find more information on ShouldProcess here.
  • Cmdlet specifies OutputType attribute if any output is produced - if the cmdlet produces no output, it should implement a PassThru parameter.

Cmdlet Parameter Guidelines

  • Parameter types should not expose types from the management library - complex parameter types should be defined in the module.
  • Complex parameter types are discouraged - a parameter type should be simple types as often as possible. If complex types are used, they should be shallow and easily creatable from a constructor or another cmdlet.
  • Cmdlet parameter sets should be mutually exclusive - each parameter set must have at least one mandatory parameter not in other parameter sets.

@@ -183,15 +183,15 @@ public AdalSession()
{
}

public override TraceLevel AuthenticationLegacyTraceLevel
public override System.Diagnostics.TraceLevel AuthenticationLegacyTraceLevel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? Is this class in a different namespace in NetCore or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Newtonsoft.

'TraceLevel' is an ambiguous reference between 'System.Diagnostics.TraceLevel' and 'Newtonsoft.Json.TraceLevel'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't fix.


<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PackageReference Include="Microsoft.Azure.Common" Version="2.1.4" />
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication" Version="2.2.12" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe these should come from common dependencies

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just grabbed some of the most common dependencies. Did you want me to shove all of them in there? 😄

</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PackageReference Include="Microsoft.Azure.Common" Version="2.1.4" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment

</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PackageReference Include="Microsoft.Azure.Common" Version="2.1.4" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment

</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PackageReference Include="Hyak.Common" Version="1.1.3" />
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.2.0" />
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.4.0" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comments about package references

@@ -23,14 +24,13 @@
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PackageReference Include="Hyak.Common" Version="1.1.3" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment on common dependencies

</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PackageReference Include="Hyak.Common" Version="1.1.3" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment on depednencies - assuem that this applies across the board for all modules


namespace Microsoft.Azure.Commands.Resources.Models
{
public static class ResourceExtensions
{
#if !NETSTANDARD
public static DeploymentExtended Deployment(this DeploymentGetResult deployment)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these aren't used anywhere in the desktop code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not since I moved us away from Microsoft.Azure.Management.Resources to Microsoft.Azure.Management.ResourceManager.

@@ -47,55 +42,6 @@ public partial class ResourcesClient
/// </summary>
/// <param name="parameters">The get parameters</param>
/// <returns>List of resources</returns>
#if !NETSTANDARD
public virtual List<PSResource> FilterPSResources(BasePSResourceParameters parameters)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above: this was based on the old ResourceManager SDK.

@@ -24,12 +24,14 @@ function Test-PolicyDefinitionCRUD

# Test
$actual = New-AzureRMPolicyDefinition -Name $policyName -Policy SamplePolicyDefinition.json
Start-Sleep 5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shopuld actually have a test/retry loop here, as it may take more than 5 seconds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hedging for xUnit support mid November. :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good luck with that. Meanwhile, there is an actual common function that does retries. Please use it here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<PackageReference Include="System.Security.SecureString" Version="4.3.0" />
<PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newtonsoft.Json is part of common dependencies, right? This applies to all usages

<PackageReference Include="Microsoft.Azure.Common" Version="2.1.4" />
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication" Version="2.2.12" />
<PackageReference Include="System.Collections.Specialized" Version="4.3.0" />
<PackageReference Include="System.Reflection" Version="4.3.0" />
<PackageReference Include="System.Security.SecureString" Version="4.3.0" />
<PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.1" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.0.0-beta.3" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newtonsoft.Json should come form Common.NetCore, right?

RequiredModules = @(@{ModuleName = 'AzureRM.Profile.Netcore'; ModuleVersion = '0.9.6'; })

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All dependencies not included in AzureRM.Profile.NetCore.psd1 will need to be listed here in RequiredAssemblies (as I obtusely noted below). This generally includes the management client assembly

@@ -54,13 +54,13 @@ PowerShellVersion = '5.1'
# RequiredModules = @()

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()
RequiredAssemblies = 'netcoreapp2.0\Microsoft.Azure.Commands.Common.Authentication.ResourceManager.dll'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the desktop version of thsi file - you will need to include the dependencies mentioned there (basically everything in your common targets file)

<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.20.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This module needs to get these assemblies form the common dependencies target

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not getting these assembl;ies form common

<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />
</packages>
<package id="Microsoft.Rest.ClientRuntime" version="2.3.6" targetFramework="net452" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove - these are retrieved by the dependency on ResourceManager common

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment.

@@ -360,7 +360,7 @@ Gets valid resource name
#>
function Get-ResourceName
{
return "some-unique-rg-name"
return "some-unique-res-name"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not the same?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rs$(Get-RandomLetters)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were some problems with making this random because some of the tests were not exactly "unit". We are throwing all of these away once xUnit is ready, correct?

@@ -24,12 +24,14 @@ function Test-PolicyDefinitionCRUD

# Test
$actual = New-AzureRMPolicyDefinition -Name $policyName -Policy SamplePolicyDefinition.json
Start-Sleep 5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good luck with that. Meanwhile, there is an actual common function that does retries. Please use it here

@@ -12,13 +12,18 @@
# limitations under the License.
# ----------------------------------------------------------------------------------

function Get-RandomLetters
{
return -join ((97..122) | Get-Random -Count 5 | % {[char]$_})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@twitchax
Copy link
Contributor Author

@azuresdkci retest this please

1 similar comment
@twitchax
Copy link
Contributor Author

@azuresdkci retest this please

@twitchax
Copy link
Contributor Author

@maddieclayton, it looks like the LocationCompleter/ResourceGroupCompleter tests can intermittently fail due to timeout.

There is a 5 second timeout, which is probably good for live usage; however, we might want to make it configurable for tests.

@maddieclayton
Copy link
Contributor

Yikes I'm on it

@twitchax
Copy link
Contributor Author

Hey @markcowl, can you take a look when you get a chance? :D

@twitchax
Copy link
Contributor Author

@markcowl, ping. 😺

Sorry to bother you.

@devigned
Copy link
Member

Looking forward to this getting merged

# RequiredAssemblies = @()
RequiredAssemblies = 'netcoreapp2.0\AutoMapper.dll',
'netcoreapp2.0\Microsoft.Azure.Management.Compute.dll',
'netcoreapp2.0\Microsoft.Azure.Management.KeyVault.dll',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to look at removing these in a future release

@@ -23,23 +27,20 @@
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PackageReference Include="Hyak.Common" Version="1.1.3" />
<PackageReference Include="Microsoft.Azure.Common" Version="2.1.4" />
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication" Version="2.2.12" />
<PackageReference Include="Microsoft.Azure.Management.ResourceManager" Version="1.6.0-preview" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to repl;ace these with common code references fairly soon, but this needs to happen for the deskop version as well

<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.20.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not getting these assembl;ies form common

<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />
</packages>
<package id="Microsoft.Rest.ClientRuntime" version="2.3.6" targetFramework="net452" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment.

@@ -24,12 +24,14 @@ function Test-PolicyDefinitionCRUD

# Test
$actual = New-AzureRMPolicyDefinition -Name $policyName -Policy SamplePolicyDefinition.json
Start-Sleep 5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markcowl
Copy link
Member

@twitchax You will need to fix the resource manager module dependencies as you did for the other modules (as noted), since this will impact backward compatibility. I would really like you to use the retry function in the tests, but will not block the PR for it.

@twitchax
Copy link
Contributor Author

@azuresdkci test this please.

@twitchax
Copy link
Contributor Author

@markcowl, take a look? :)

@markcowl
Copy link
Member

@twitchax
Copy link
Contributor Author

@markcowl...green! 🚀

@cormacpayne
Copy link
Member

@markcowl markcowl merged commit b82f28b into Azure:preview Nov 30, 2017
@twitchax twitchax deleted the netcore branch December 3, 2017 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants