Skip to content

Commit 7ac43c3

Browse files
author
Hovsep
committed
Merge pull request Azure#1331 from hovsepm/clu
Added resource cmdlets.
2 parents 6d2d784 + de3ed31 commit 7ac43c3

File tree

128 files changed

+25147
-45
lines changed

Some content is hidden

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

128 files changed

+25147
-45
lines changed

src/CLU/CLUCoreCLR.sln

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 14
4-
VisualStudioVersion = 14.0.23107.0
4+
VisualStudioVersion = 14.0.24711.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Commands.Common", "Commands.Common\Commands.Common.xproj", "{5F567ACA-595E-436D-83DB-A21E08F82DF6}"
77
EndProject
@@ -17,6 +17,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Azure.Commands.Pr
1717
EndProject
1818
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Commands.ScenarioTests.ResourceManager.Common", "Commands.ScenarioTests.ResourceManager.Common\Commands.ScenarioTests.ResourceManager.Common.xproj", "{9D1F91E1-B319-4914-B09B-60070C5531C7}"
1919
EndProject
20+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Azure.Commands.Resources", "Microsoft.Azure.Commands.Resources\Microsoft.Azure.Commands.Resources.xproj", "{99B1290D-A073-4907-8018-51C714431778}"
21+
EndProject
2022
Global
2123
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2224
Debug|Any CPU = Debug|Any CPU
@@ -51,6 +53,10 @@ Global
5153
{9D1F91E1-B319-4914-B09B-60070C5531C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
5254
{9D1F91E1-B319-4914-B09B-60070C5531C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
5355
{9D1F91E1-B319-4914-B09B-60070C5531C7}.Release|Any CPU.Build.0 = Release|Any CPU
56+
{99B1290D-A073-4907-8018-51C714431778}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
57+
{99B1290D-A073-4907-8018-51C714431778}.Debug|Any CPU.Build.0 = Debug|Any CPU
58+
{99B1290D-A073-4907-8018-51C714431778}.Release|Any CPU.ActiveCfg = Release|Any CPU
59+
{99B1290D-A073-4907-8018-51C714431778}.Release|Any CPU.Build.0 = Release|Any CPU
5460
EndGlobalSection
5561
GlobalSection(SolutionProperties) = preSolution
5662
HideSolutionNode = FALSE

src/CLU/Commands.Common.Authentication/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"frameworks": {
99
"dnxcore50": {
1010
"dependencies": {
11-
"Microsoft.CLU": "1.0.0-*",
11+
"Microsoft.CLU": "0.0.1-beta-151119",
1212
"Microsoft.CSharp": "4.0.1-beta-23409",
1313
"System.Linq": "4.0.1-beta-23409"
1414
}

src/CLU/Commands.Common/GeneralUtilities.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,25 @@ public static Uri CreateHttpsEndpoint(string endpointUri)
347347
return new Uri(endpoint);
348348
}
349349

350+
public static string DownloadFile(string uri)
351+
{
352+
string contents = null;
353+
354+
using (HttpClient httClient = new HttpClient())
355+
{
356+
try
357+
{
358+
contents = httClient.GetStringAsync(uri).ConfigureAwait(false).GetAwaiter().GetResult();
359+
}
360+
catch
361+
{
362+
// Ignore the exception and return empty contents
363+
}
364+
}
365+
366+
return contents;
367+
}
368+
350369
public static string GenerateSeparator(int amount, string separator)
351370
{
352371
StringBuilder result = new StringBuilder();

src/CLU/Commands.Common/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"frameworks": {
99
"dnxcore50": {
1010
"dependencies": {
11-
"Microsoft.CLU": "1.0.0-*",
11+
"Microsoft.CLU": "0.0.1-beta-151119",
1212
"Microsoft.CSharp": "4.0.1-beta-23409",
1313
"System.Linq": "4.0.1-beta-23409"
1414
}

src/CLU/Commands.ResourceManager.Cmdlets/Properties/Resources.Designer.cs

Lines changed: 0 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/CLU/Commands.ResourceManager.Cmdlets/Properties/Resources.resx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,6 @@
126126
<data name="InvalidTagFormatNotUniqueName" xml:space="preserve">
127127
<value>Invalid tag format. Ensure that each tag has a unique name. Example: @{Name = "tagName1"; Value = "tagValue1"}, @{Name = "tagName2"; Value = "tagValue2"}</value>
128128
</data>
129-
<data name="RemoveTagMessage" xml:space="preserve">
130-
<value>Removing tag ....</value>
131-
</data>
132-
<data name="RemovingTag" xml:space="preserve">
133-
<value>Are you sure you want to remove tag '{0}'</value>
134-
</data>
135129
<data name="TagNotFoundMessage" xml:space="preserve">
136130
<value>Tag '{0}' not found</value>
137131
</data>

src/CLU/Commands.ResourceManager.Cmdlets/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"frameworks": {
99
"dnxcore50": {
1010
"dependencies": {
11-
"Microsoft.CLU": "1.0.0-*",
11+
"Microsoft.CLU": "0.0.1-beta-151119",
1212
"Microsoft.CSharp": "4.0.1-beta-23409",
1313
"System.Linq": "4.0.1-beta-23409"
1414
}

src/CLU/Commands.ResourceManager.Common/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"frameworks": {
99
"dnxcore50": {
1010
"dependencies": {
11-
"Microsoft.CLU": "1.0.0-*",
11+
"Microsoft.CLU": "0.0.1-beta-151119",
1212
"Microsoft.CSharp": "4.0.1-beta-23409",
1313
"System.Linq": "4.0.1-beta-23409"
1414
}

src/CLU/Commands.ScenarioTests.ResourceManager.Common/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"frameworks": {
99
"dnxcore50": {
1010
"dependencies": {
11-
"Microsoft.CLU": "1.0.0-*",
11+
"Microsoft.CLU": "0.0.1-beta-151119",
1212
"Microsoft.CSharp": "4.0.1-beta-23409",
1313
"System.Linq": "4.0.1-beta-23409"
1414
}

src/CLU/Microsoft.Azure.Commands.Profile.Test/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"frameworks": {
99
"dnxcore50": {
1010
"dependencies": {
11-
"Microsoft.CLU": "1.0.0-*",
11+
"Microsoft.CLU": "0.0.1-beta-151119",
1212
"Microsoft.CSharp": "4.0.1-beta-23409",
1313
"System.Linq": "4.0.1-beta-23409"
1414
}

src/CLU/Microsoft.Azure.Commands.Profile/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"frameworks": {
99
"dnxcore50": {
1010
"dependencies": {
11-
"Microsoft.CLU": "1.0.0-*",
11+
"Microsoft.CLU": "0.0.1-beta-151119",
1212
"Microsoft.CSharp": "4.0.1-beta-23409",
1313
"System.Linq": "4.0.1-beta-23409"
1414
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Commands.ActiveDirectory.Models;
16+
using Microsoft.Azure.Commands.Resources.Models.ActiveDirectory;
17+
using System;
18+
using System.Collections.Generic;
19+
using System.Management.Automation;
20+
21+
namespace Microsoft.Azure.Commands.ActiveDirectory
22+
{
23+
/// <summary>
24+
/// Get AD groups.
25+
/// </summary>
26+
[Cmdlet(VerbsCommon.Get, "AzureRmADGroup", DefaultParameterSetName = ParameterSet.Empty), OutputType(typeof(List<PSADGroup>))]
27+
public class GetAzureADGroupCommand : ActiveDirectoryBaseCmdlet
28+
{
29+
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.SearchString,
30+
HelpMessage = "The user or group name.")]
31+
[ValidateNotNullOrEmpty]
32+
public string SearchString { get; set; }
33+
34+
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.Empty,
35+
HelpMessage = "The group id.")]
36+
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ObjectId,
37+
HelpMessage = "The group id.")]
38+
[ValidateNotNullOrEmpty]
39+
public Guid ObjectId { get; set; }
40+
41+
protected override void ProcessRecord()
42+
{
43+
ADObjectFilterOptions options = new ADObjectFilterOptions
44+
{
45+
SearchString = SearchString,
46+
Id = ObjectId == Guid.Empty ? null : ObjectId.ToString(),
47+
Paging = true
48+
};
49+
50+
do
51+
{
52+
WriteObject(ActiveDirectoryClient.FilterGroups(options), true);
53+
} while (!string.IsNullOrEmpty(options.NextLink));
54+
}
55+
}
56+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Commands.ActiveDirectory.Models;
16+
using Microsoft.Azure.Commands.Resources.Models.ActiveDirectory;
17+
using System;
18+
using System.Collections.Generic;
19+
using System.Management.Automation;
20+
21+
namespace Microsoft.Azure.Commands.ActiveDirectory
22+
{
23+
/// <summary>
24+
/// Get AD groups members.
25+
/// </summary>
26+
[Cmdlet(VerbsCommon.Get, "AzureRmADGroupMember", DefaultParameterSetName = ParameterSet.Empty), OutputType(typeof(List<PSADObject>))]
27+
public class GetAzureADGroupMemberCommand : ActiveDirectoryBaseCmdlet
28+
{
29+
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The user email address.")]
30+
[ValidateNotNullOrEmpty]
31+
public Guid GroupObjectId { get; set; }
32+
33+
protected override void ProcessRecord()
34+
{
35+
ADObjectFilterOptions options = new ADObjectFilterOptions
36+
{
37+
Id = GroupObjectId == Guid.Empty ? null : GroupObjectId.ToString(),
38+
Paging = true
39+
};
40+
41+
do
42+
{
43+
WriteObject(ActiveDirectoryClient.GetGroupMembers(options), true);
44+
} while (!string.IsNullOrEmpty(options.NextLink));
45+
}
46+
}
47+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Commands.ActiveDirectory.Models;
16+
using Microsoft.Azure.Commands.Resources.Models.ActiveDirectory;
17+
using System;
18+
using System.Collections.Generic;
19+
using System.Management.Automation;
20+
21+
namespace Microsoft.Azure.Commands.ActiveDirectory
22+
{
23+
/// <summary>
24+
/// Get AD users.
25+
/// </summary>
26+
[Cmdlet(VerbsCommon.Get, "AzureRmADServicePrincipal", DefaultParameterSetName = ParameterSet.Empty), OutputType(typeof(List<PSADServicePrincipal>))]
27+
public class GetAzureADServicePrincipalCommand : ActiveDirectoryBaseCmdlet
28+
{
29+
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.SearchString,
30+
HelpMessage = "The service principal search string.")]
31+
[ValidateNotNullOrEmpty]
32+
public string SearchString { get; set; }
33+
34+
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.ObjectId,
35+
HelpMessage = "The service principal object id.")]
36+
[ValidateNotNullOrEmpty]
37+
public Guid ObjectId { get; set; }
38+
39+
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.Empty,
40+
HelpMessage = "The user SPN.")]
41+
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ParameterSet.SPN,
42+
HelpMessage = "The user SPN.")]
43+
[ValidateNotNullOrEmpty]
44+
[Alias("SPN")]
45+
public string ServicePrincipalName { get; set; }
46+
47+
protected override void ProcessRecord()
48+
{
49+
ADObjectFilterOptions options = new ADObjectFilterOptions
50+
{
51+
SearchString = SearchString,
52+
SPN = ServicePrincipalName,
53+
Id = ObjectId == Guid.Empty ? null : ObjectId.ToString(),
54+
Paging = true
55+
};
56+
57+
do
58+
{
59+
WriteObject(ActiveDirectoryClient.FilterServicePrincipals(options), true);
60+
61+
} while (!string.IsNullOrEmpty(options.NextLink));
62+
}
63+
}
64+
}

0 commit comments

Comments
 (0)