Skip to content

Clu #259

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 6 commits into from
Dec 18, 2015
Merged

Clu #259

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/CLU/Commands.Common.Authentication/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"System.Linq": "4.0.1-beta-23516",
"Microsoft.CLU": "1.0.0",
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
"Microsoft.Rest.ClientRuntime": "1.8.0",
"Microsoft.Rest.ClientRuntime": "1.8.1",
"Microsoft.Rest.ClientRuntime.Azure.Authentication": "1.2.1-preview",
"Newtonsoft.Json": "7.0.1",
"System.Collections": "4.0.11-beta-23516",
Expand Down
2 changes: 1 addition & 1 deletion src/CLU/Commands.Common.Storage/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"Commands.Common": "",
"Commands.Common.Authentication": "",
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
"Microsoft.Rest.ClientRuntime": "1.8.0",
"Microsoft.Rest.ClientRuntime": "1.8.1",
"Newtonsoft.Json": "7.0.1",
"System.Collections": "4.0.11-beta-23516",
"System.Collections.Concurrent": "4.0.11-beta-23516",
Expand Down
2 changes: 1 addition & 1 deletion src/CLU/Commands.Common/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"Microsoft.CLU": "1.0.0",
"Commands.Common.Authentication": "",
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
"Microsoft.Rest.ClientRuntime": "1.8.0",
"Microsoft.Rest.ClientRuntime": "1.8.1",
"Newtonsoft.Json": "7.0.1",
"System.Collections": "4.0.11-beta-23516",
"System.Collections.Concurrent": "4.0.11-beta-23516",
Expand Down
2 changes: 1 addition & 1 deletion src/CLU/Commands.ResourceManager.Cmdlets/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"Commands.Common": "",
"Commands.ResourceManager.Common": "",
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
"Microsoft.Rest.ClientRuntime": "1.8.0",
"Microsoft.Rest.ClientRuntime": "1.8.1",
"Newtonsoft.Json": "7.0.1",
"System.Collections": "4.0.11-beta-23516",
"System.Collections.Concurrent": "4.0.11-beta-23516",
Expand Down
2 changes: 1 addition & 1 deletion src/CLU/Commands.ResourceManager.Common/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"Commands.Common": "",
"Commands.Common.Authentication": "",
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
"Microsoft.Rest.ClientRuntime": "1.8.0",
"Microsoft.Rest.ClientRuntime": "1.8.1",
"Newtonsoft.Json": "7.0.1",
"System.Collections": "4.0.11-beta-23516",
"System.Collections.Concurrent": "4.0.11-beta-23516",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"Commands.ResourceManager.Common": "",
"Microsoft.Azure.Management.Resources": "3.3.0-preview",
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
"Microsoft.Rest.ClientRuntime": "1.8.0",
"Microsoft.Rest.ClientRuntime.Azure": "2.5.1",
"Microsoft.Rest.ClientRuntime": "1.8.1",
"Microsoft.Rest.ClientRuntime.Azure": "2.5.3",
"Microsoft.Rest.ClientRuntime.Azure.Authentication": "1.2.1-preview",
"Newtonsoft.Json": "7.0.1",
"System.Collections": "4.0.11-beta-23516",
Expand Down
2 changes: 1 addition & 1 deletion src/CLU/Microsoft.Azure.Commands.Compute.Test/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"Microsoft.Azure.Management.Network": "3.0.3-preview",
"Microsoft.Azure.Management.Storage": "4.0.0-preview",
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
"Microsoft.Rest.ClientRuntime": "1.8.0",
"Microsoft.Rest.ClientRuntime": "1.8.1",
"Newtonsoft.Json": "7.0.1",
"System.Collections": "4.0.11-beta-23516",
"System.Collections.Concurrent": "4.0.11-beta-23516",
Expand Down
2 changes: 1 addition & 1 deletion src/CLU/Microsoft.Azure.Commands.Compute/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"Commands.Common.Storage": "",
"Commands.ResourceManager.Common": "",
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
"Microsoft.Rest.ClientRuntime": "1.8.0",
"Microsoft.Rest.ClientRuntime": "1.8.1",
"Newtonsoft.Json": "7.0.1",
"System.Collections": "4.0.11-beta-23516",
"System.Collections.Concurrent": "4.0.11-beta-23516",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"Commands.Common.Storage": "",
"Commands.ResourceManager.Common": "",
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
"Microsoft.Rest.ClientRuntime": "1.8.0",
"Microsoft.Rest.ClientRuntime": "1.8.1",
"Newtonsoft.Json": "7.0.1",
"System.Collections": "4.0.11-beta-23516",
"System.Collections.Concurrent": "4.0.11-beta-23516",
Expand Down
4 changes: 2 additions & 2 deletions src/CLU/Microsoft.Azure.Commands.Profile.Test/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"Microsoft.Azure.Commands.Profile": "",
"Microsoft.Azure.Management.Resources": "3.3.0-preview",
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
"Microsoft.Rest.ClientRuntime": "1.8.0",
"Microsoft.Rest.ClientRuntime.Azure": "2.5.1",
"Microsoft.Rest.ClientRuntime": "1.8.1",
"Microsoft.Rest.ClientRuntime.Azure": "2.5.3",
"Microsoft.Rest.ClientRuntime.Azure.Authentication": "1.2.1-preview",
"Newtonsoft.Json": "7.0.1",
"System.Collections": "4.0.11-beta-23516",
Expand Down
4 changes: 2 additions & 2 deletions src/CLU/Microsoft.Azure.Commands.Profile/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"Commands.ResourceManager.Common": "",
"Microsoft.Azure.Management.Resources": "3.3.0-preview",
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
"Microsoft.Rest.ClientRuntime": "1.8.0",
"Microsoft.Rest.ClientRuntime.Azure": "2.5.1",
"Microsoft.Rest.ClientRuntime": "1.8.1",
"Microsoft.Rest.ClientRuntime.Azure": "2.5.3",
"Microsoft.Rest.ClientRuntime.Azure.Authentication": "1.2.1-preview",
"Newtonsoft.Json": "7.0.1",
"System.Collections": "4.0.11-beta-23516",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void ValidatesPSResourceGroupDeploymentWithUserTemplate()
Assert.Equal(expectedParameters.TemplateFile, actualParameters.TemplateFile);
Assert.NotNull(actualParameters.TemplateParameterObject);

commandRuntimeMock.Verify(f => f.WriteObject(expected), Times.Once());
commandRuntimeMock.Verify(f => f.WriteObject(expected, true), Times.Once());
}
}
}
6 changes: 3 additions & 3 deletions src/CLU/Microsoft.Azure.Commands.Resources.Test/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
"Commands.ScenarioTests.ResourceManager.Common": "",
"Microsoft.Azure.Commands.Profile": "",
"Microsoft.Azure.Commands.Resources": "",
"Microsoft.Azure.Graph.RBAC": "2.0.0-preview",
"Microsoft.Azure.Graph.RBAC": "2.1.0-preview",
"Microsoft.Azure.Management.Authorization": "2.1.0-preview",
"Microsoft.Azure.Management.Resources": "3.3.0-preview",
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
"Microsoft.Rest.ClientRuntime": "1.8.0",
"Microsoft.Rest.ClientRuntime.Azure": "2.5.1",
"Microsoft.Rest.ClientRuntime": "1.8.1",
"Microsoft.Rest.ClientRuntime.Azure": "2.5.3",
"Microsoft.Rest.ClientRuntime.Azure.Authentication": "1.2.1-preview",
"Newtonsoft.Json": "7.0.1",
"System.Collections": "4.0.11-beta-23516",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using Microsoft.Azure.Graph.RBAC;
using Microsoft.Azure.Graph.RBAC.Models;
using Microsoft.Rest.Azure;
using Microsoft.Rest.Azure.OData;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand All @@ -39,9 +40,10 @@ public ActiveDirectoryClient(IAuthenticationFactory authenticationFactory, IClie
{
AccessTokenCredential creds = (AccessTokenCredential)authenticationFactory.GetSubscriptionCloudCredentials(context);
GraphClient = clientFactory.CreateCustomArmClient<GraphRbacManagementClient>(
creds.TenantID,
creds,
context.Environment.GetEndpointAsUri(AzureEnvironment.Endpoint.Graph));
context.Environment.GetEndpointAsUri(AzureEnvironment.Endpoint.Graph),
creds);
GraphClient.TenantID = creds.TenantID;
GraphClient.SubscriptionId = creds.SubscriptionId;
}

public PSADObject GetADObject(ADObjectFilterOptions options)
Expand Down Expand Up @@ -101,7 +103,7 @@ public List<PSADServicePrincipal> FilterServicePrincipals(ADObjectFilterOptions
try
{
servicePrincipal = GraphClient.ServicePrincipal
.List(item => item.ServicePrincipalNames.Contains(options.SPN))
.List(new ODataQuery<ServicePrincipal>(item => item.ServicePrincipalNames.Contains(options.SPN)))
.FirstOrDefault();
}
catch { /* The user does not exist, ignore the exception. */ }
Expand All @@ -120,7 +122,7 @@ public List<PSADServicePrincipal> FilterServicePrincipals(ADObjectFilterOptions
if (string.IsNullOrEmpty(options.NextLink))
{
result = GraphClient.ServicePrincipal
.List(item => item.DisplayName.StartsWith(options.SearchString) );
.List(new ODataQuery<ServicePrincipal>(item => item.DisplayName.StartsWith(options.SearchString)));
}
else
{
Expand All @@ -132,7 +134,7 @@ public List<PSADServicePrincipal> FilterServicePrincipals(ADObjectFilterOptions
}
else
{
result = GraphClient.ServicePrincipal.List(item => item.DisplayName.StartsWith(options.SearchString));
result = GraphClient.ServicePrincipal.List(new ODataQuery<ServicePrincipal>(item => item.DisplayName.StartsWith(options.SearchString)));
servicePrincipals.AddRange(result.Select(u => u.ToPSADServicePrincipal()));

while (!string.IsNullOrEmpty(result.NextPageLink))
Expand Down Expand Up @@ -175,7 +177,7 @@ public List<PSADUser> FilterUsers(ADObjectFilterOptions options)
try
{
user = GraphClient.User
.List(item => item.SignInName == (Normalize(options.Mail) ?? Normalize(options.SignInName)))
.List(new ODataQuery<User>(item => item.SignInName == (Normalize(options.Mail) ?? Normalize(options.SignInName))))
.FirstOrDefault();
}
catch { /* The user does not exist, ignore the exception. */ }
Expand All @@ -191,7 +193,7 @@ public List<PSADUser> FilterUsers(ADObjectFilterOptions options)
{
if (string.IsNullOrEmpty(options.NextLink))
{
result = GraphClient.User.List(item => item.DisplayName.StartsWith(options.SearchString));
result = GraphClient.User.List(new ODataQuery<User>(item => item.DisplayName.StartsWith(options.SearchString)));
}
else
{
Expand All @@ -203,7 +205,7 @@ public List<PSADUser> FilterUsers(ADObjectFilterOptions options)
}
else
{
result = GraphClient.User.List(item => item.DisplayName.StartsWith(options.SearchString));
result = GraphClient.User.List(new ODataQuery<User>(item => item.DisplayName.StartsWith(options.SearchString)));
users.AddRange(result.Select(u => u.ToPSADUser()));

while (!string.IsNullOrEmpty(result.NextPageLink))
Expand Down Expand Up @@ -273,8 +275,8 @@ public List<PSADGroup> FilterGroups(ADObjectFilterOptions options)
{
if (string.IsNullOrEmpty(options.NextLink))
{
result = GraphClient.Group.List(
item => item.Mail == options.Mail && item.DisplayName.StartsWith(options.SearchString));
result = GraphClient.Group.List(new ODataQuery<ADGroup>(
item => item.Mail == options.Mail && item.DisplayName.StartsWith(options.SearchString)));
}
else
{
Expand All @@ -286,8 +288,8 @@ public List<PSADGroup> FilterGroups(ADObjectFilterOptions options)
}
else
{
result = GraphClient.Group.List(
item => item.Mail == options.Mail && item.DisplayName.StartsWith(options.SearchString));
result = GraphClient.Group.List(new ODataQuery<ADGroup>(
item => item.Mail == options.Mail && item.DisplayName.StartsWith(options.SearchString)));
groups.AddRange(result.Select(g => g.ToPSADGroup()));

while (!string.IsNullOrEmpty(result.NextPageLink))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static AuthorizationClient()
public AuthorizationClient(IAuthenticationFactory authenticationFactory, IClientFactory clientFactory, AzureContext context)
{
ActiveDirectoryClient = new ActiveDirectoryClient(authenticationFactory, clientFactory, context);
AuthorizationManagementClient = clientFactory.CreateClient<AuthorizationManagementClient>(context, AzureEnvironment.Endpoint.ResourceManager);
AuthorizationManagementClient = clientFactory.CreateArmClient<AuthorizationManagementClient>(context, AzureEnvironment.Endpoint.ResourceManager);
}

/// <summary>
Expand All @@ -80,7 +80,7 @@ public PSRoleDefinition GetRoleDefinition(string roleId)
public PSRoleDefinition GetRoleDefinition(Guid roleId)
{
return AuthorizationManagementClient.RoleDefinitions.Get(
"subscription/" + AuthorizationManagementClient.SubscriptionId,
"subscriptions/" + AuthorizationManagementClient.SubscriptionId,
roleId.ToString()).ToPSRoleDefinition();
}

Expand All @@ -94,7 +94,7 @@ public List<PSRoleDefinition> FilterRoleDefinitions(string name)
{
List<PSRoleDefinition> result = new List<PSRoleDefinition>();
result.AddRange(AuthorizationManagementClient.RoleDefinitions.List(
"subscription/" + AuthorizationManagementClient.SubscriptionId,
"subscriptions/" + AuthorizationManagementClient.SubscriptionId,
new ODataQuery<RoleDefinition>( item => item.Name == name))
.Select(r => r.ToPSRoleDefinition()));

Expand All @@ -109,7 +109,7 @@ public List<PSRoleDefinition> GetRoleDefinitions()
{
List<PSRoleDefinition> result = new List<PSRoleDefinition>();
result.AddRange(AuthorizationManagementClient.RoleDefinitions.List(
"subscription/" + AuthorizationManagementClient.SubscriptionId)
"subscriptions/" + AuthorizationManagementClient.SubscriptionId)
.Select(r => r.ToPSRoleDefinition()));
return result;
}
Expand All @@ -122,7 +122,7 @@ public List<PSRoleDefinition> FilterRoleDefinitionsByCustom()
{
List<PSRoleDefinition> result = new List<PSRoleDefinition>();
result.AddRange(AuthorizationManagementClient.RoleDefinitions.List(
"subscription/" + AuthorizationManagementClient.SubscriptionId)
"subscriptions/" + AuthorizationManagementClient.SubscriptionId)
.Where(r => r.Properties.Type == AuthorizationClientExtensions.CustomRole)
.Select(r => r.ToPSRoleDefinition()));
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ namespace Microsoft.Azure.Commands.Resources.ResourceGroupDeployments
/// <summary>
/// Validate a template to see whether it's using the right syntax, resource providers, resource types, etc.
/// </summary>
[Cmdlet(VerbsDiagnostic.Test, "AzureRmResourceGroupDeployment", DefaultParameterSetName = ParameterlessTemplateFileParameterSetName), OutputType(typeof(List<PSResourceManagerError>))]
[Cmdlet(VerbsDiagnostic.Test, "AzureRmResourceGroupDeployment", DefaultParameterSetName = ParameterlessTemplateFileParameterSetName),
OutputType(typeof(PSResourceManagerError))]
public class TestAzureResourceGroupDeploymentCommand : ResourceWithParameterBaseCmdlet, IDynamicParameters
{
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource group name.")]
Expand All @@ -49,7 +50,7 @@ protected override void ProcessRecord()
ParameterUri = TemplateParameterUri
};

WriteObject(ResourcesClient.ValidatePSResourceGroupDeployment(parameters, Mode));
WriteObject(ResourcesClient.ValidatePSResourceGroupDeployment(parameters, Mode), enumerateCollection: true);
}
}
}
6 changes: 3 additions & 3 deletions src/CLU/Microsoft.Azure.Commands.Resources/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
"Commands.Common": "",
"Commands.ResourceManager.Common": "",
"Commands.ResourceManager.Cmdlets": "",
"Microsoft.Azure.Graph.RBAC": "2.0.0-preview",
"Microsoft.Azure.Graph.RBAC": "2.1.0-preview",
"Microsoft.Azure.Management.Authorization": "2.1.0-preview",
"Microsoft.Azure.Management.Resources": "3.3.0-preview",
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
"Microsoft.Rest.ClientRuntime": "1.8.0",
"Microsoft.Rest.ClientRuntime.Azure": "2.5.1",
"Microsoft.Rest.ClientRuntime": "1.8.1",
"Microsoft.Rest.ClientRuntime.Azure": "2.5.3",
"Microsoft.Rest.ClientRuntime.Azure.Authentication": "1.2.1-preview",
"Newtonsoft.Json": "7.0.1",
"System.Collections": "4.0.11-beta-23516",
Expand Down
4 changes: 2 additions & 2 deletions src/CLU/Microsoft.Azure.Commands.Websites.Test/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"Microsoft.Azure.Management.Resources": "3.3.0-preview",
"Microsoft.Azure.Management.Websites": "1.0.0-preview",
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
"Microsoft.Rest.ClientRuntime": "1.8.0",
"Microsoft.Rest.ClientRuntime.Azure": "2.5.1",
"Microsoft.Rest.ClientRuntime": "1.8.1",
"Microsoft.Rest.ClientRuntime.Azure": "2.5.3",
"Microsoft.Rest.ClientRuntime.Azure.Authentication": "1.2.1-preview",
"Newtonsoft.Json": "7.0.1",
"System.Collections": "4.0.11-beta-23516",
Expand Down
6 changes: 3 additions & 3 deletions src/CLU/Microsoft.Azure.Commands.Websites/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
"Commands.ResourceManager.Cmdlets": "",
"Microsoft.Azure.Commands.Resources": "",
"Microsoft.Azure.Commands.Profile": "",
"Microsoft.Azure.Graph.RBAC": "2.0.0-preview",
"Microsoft.Azure.Graph.RBAC": "2.1.0-preview",
"Microsoft.Azure.Management.Authorization": "2.1.0-preview",
"Microsoft.Azure.Management.Resources": "3.3.0-preview",
"Microsoft.Azure.Management.Websites": "1.0.0-preview",
"Microsoft.IdentityModel.Clients.ActiveDirectory": "3.6.212041202-alpha",
"Microsoft.Rest.ClientRuntime": "1.8.0",
"Microsoft.Rest.ClientRuntime.Azure": "2.5.1",
"Microsoft.Rest.ClientRuntime": "1.8.1",
"Microsoft.Rest.ClientRuntime.Azure": "2.5.3",
"Microsoft.Rest.ClientRuntime.Azure.Authentication": "1.2.1-preview",
"Newtonsoft.Json": "7.0.1",
"System.Collections": "4.0.11-beta-23516",
Expand Down
Loading