Skip to content

Commit c0a0810

Browse files
BethanyZhouazure-powershell-botVeryEarly
authored
Move Resources to main (#17614)
* Move Resources to main * Update ChangeLog.md Co-authored-by: azure-powershell-bot <[email protected]> Co-authored-by: Yabo Hu <[email protected]>
1 parent 4c65590 commit c0a0810

File tree

174 files changed

+902
-850
lines changed

Some content is hidden

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

174 files changed

+902
-850
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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 System;
16+
using System.Reflection;
17+
using System.Runtime.InteropServices;
18+
19+
[assembly: AssemblyTitle("Microsoft Azure Powershell - Authorization")]
20+
[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)]
21+
[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)]
22+
[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)]
23+
24+
[assembly: ComVisible(false)]
25+
[assembly: CLSCompliant(false)]
26+
[assembly: Guid("b2f7fb23-24cf-4e26-840e-db4360603829")]
27+
[assembly: AssemblyVersion("0.1.0")]
28+
[assembly: AssemblyFileVersion("0.1.0")]

src/Resources/Authorization.Autorest/create-model-cmdlets.ps1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ function CreateModelCmdlet {
115115
# check whether completer is needed
116116
$completer = '';
117117
if($Type.Split('.').Split('.')[-2] -eq 'Support') {
118-
$completer += "`n [ArgumentCompleter([${Type}])]"
118+
# If Type is an array, need to strip []
119+
$strippedType = $Type.Replace('[]', '')
120+
$completer += "`n [ArgumentCompleter([${strippedType}])]"
119121
}
120122
$ParameterDefineScript = "
121123
[Parameter($ParameterDefineProperty)]${completer}

src/Resources/Authorization.Autorest/docs/Az.Authorization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Module Name: Az.Authorization
3-
Module Guid: af1acdc0-484d-477e-a2d2-8c6e6136323f
3+
Module Guid: 66aa3bd8-7952-4e71-915e-f7d169a2440e
44
Download Help Link: https://docs.microsoft.com/powershell/module/az.authorization
55
Help Version: 1.0.0.0
66
Locale: en-US
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"swagger_commit": "c277c1bc2a40d5b5d2b1792e611291e708246d0e",
3+
"node": "v14.15.5",
4+
"autorest_powershell": "3.0.480",
5+
"autorest": "`-- (empty)",
6+
"autorest_modelerfour": "4.15.414",
7+
"autorest_core": "3.8.2"
8+
}

src/Resources/Authorization.Autorest/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,44 @@ public override string ToString()
5252

5353
internal class HelpExampleOutput
5454
{
55+
private string ExampleTemplate =
56+
"{0}{1}" + Environment.NewLine +
57+
"{2}" + Environment.NewLine + "{3}" + Environment.NewLine + "{4}" + Environment.NewLine + Environment.NewLine +
58+
"{5}" + Environment.NewLine + Environment.NewLine;
59+
60+
private string ExampleTemplateWithOutput =
61+
"{0}{1}" + Environment.NewLine +
62+
"{2}" + Environment.NewLine + "{3}" + Environment.NewLine + "{4}" + Environment.NewLine + Environment.NewLine +
63+
"{5}" + Environment.NewLine + "{6}" + Environment.NewLine + "{7}" + Environment.NewLine + Environment.NewLine +
64+
"{8}" + Environment.NewLine + Environment.NewLine;
65+
5566
public MarkdownExampleHelpInfo ExampleInfo { get; }
5667

5768
public HelpExampleOutput(MarkdownExampleHelpInfo exampleInfo)
5869
{
5970
ExampleInfo = exampleInfo;
6071
}
6172

62-
public override string ToString() => $@"{ExampleNameHeader}{ExampleInfo.Name}
63-
{ExampleCodeHeader}
64-
{ExampleInfo.Code}
65-
{ExampleCodeFooter}
66-
67-
{ExampleInfo.Description.ToDescriptionFormat()}
68-
69-
";
73+
public override string ToString()
74+
{
75+
if (string.IsNullOrEmpty(ExampleInfo.Output))
76+
{
77+
return string.Format(ExampleTemplate,
78+
ExampleNameHeader, ExampleInfo.Name,
79+
ExampleCodeHeader, ExampleInfo.Code, ExampleCodeFooter,
80+
ExampleInfo.Description.ToDescriptionFormat());
81+
}
82+
else
83+
{
84+
return string.Format(ExampleTemplateWithOutput,
85+
ExampleNameHeader, ExampleInfo.Name,
86+
ExampleCodeHeader, ExampleInfo.Code, ExampleCodeFooter,
87+
ExampleOutputHeader, ExampleInfo.Output, ExampleOutputFooter,
88+
ExampleInfo.Description.ToDescriptionFormat()); ;
89+
}
90+
}
7091
}
71-
72-
92+
7393
internal class HelpParameterOutput
7494
{
7595
public MarkdownParameterHelpInfo ParameterInfo { get; }
@@ -161,6 +181,8 @@ public static string ToDescriptionFormat(this string text, bool escapeAngleBrack
161181
public const string ExampleNameHeader = "### ";
162182
public const string ExampleCodeHeader = "```powershell";
163183
public const string ExampleCodeFooter = "```";
184+
public const string ExampleOutputHeader = "```output";
185+
public const string ExampleOutputFooter = "```";
164186

165187
public static HelpMetadataOutput ToHelpMetadataOutput(this MarkdownHelpInfo helpInfo) => new HelpMetadataOutput(helpInfo);
166188

src/Resources/Authorization.Autorest/generated/runtime/BuildTime/Models/PsHelpTypes.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,21 @@ internal class PsHelpExampleInfo
109109
{
110110
public string Title { get; }
111111
public string Code { get; }
112+
public string Output { get; }
112113
public string Remarks { get; }
113114

114115
public PsHelpExampleInfo(PSObject exampleObject)
115116
{
116117
Title = exampleObject.GetProperty<string>("title");
117118
Code = exampleObject.GetProperty<string>("code");
119+
Output = exampleObject.GetProperty<string>("output");
118120
Remarks = exampleObject.GetProperty<PSObject[]>("remarks").EmptyIfNull().ToDescriptionText();
119121
}
120122
public PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample)
121123
{
122124
Title = markdownExample.Name;
123125
Code = markdownExample.Code;
126+
Output = markdownExample.Output;
124127
Remarks = markdownExample.Description;
125128
}
126129

src/Resources/Authorization.Autorest/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,17 @@ private MarkdownExampleHelpInfo[] GetExamplesFromMarkdown(string examplesFolder)
9191
var code = codeStartIndex.HasValue && codeEndIndex.HasValue
9292
? String.Join(Environment.NewLine, eg.Skip(codeStartIndex.Value + 1).Take(codeEndIndex.Value - (codeStartIndex.Value + 1)))
9393
: String.Empty;
94-
var descriptionStartIndex = (codeEndIndex ?? 0) + 1;
94+
var outputStartIndex = eg.Select((l, i) => l.StartsWith(ExampleOutputHeader) ? (int?)i : null).FirstOrDefault(i => i.HasValue);
95+
var outputEndIndex = eg.Select((l, i) => l.StartsWith(ExampleOutputFooter) ? (int?)i : null).FirstOrDefault(i => i.HasValue && i > outputStartIndex);
96+
var output = outputStartIndex.HasValue && outputEndIndex.HasValue
97+
? String.Join(Environment.NewLine, eg.Skip(outputStartIndex.Value + 1).Take(outputEndIndex.Value - (outputStartIndex.Value + 1)))
98+
: String.Empty;
99+
var descriptionStartIndex = (outputEndIndex ?? (codeEndIndex ?? 0)) + 1;
95100
descriptionStartIndex = String.IsNullOrWhiteSpace(eg[descriptionStartIndex]) ? descriptionStartIndex + 1 : descriptionStartIndex;
96101
var descriptionEndIndex = eg.Length - 1;
97102
descriptionEndIndex = String.IsNullOrWhiteSpace(eg[descriptionEndIndex]) ? descriptionEndIndex - 1 : descriptionEndIndex;
98103
var description = String.Join(Environment.NewLine, eg.Skip(descriptionStartIndex).Take((descriptionEndIndex + 1) - descriptionStartIndex));
99-
return new MarkdownExampleHelpInfo(name, code, description);
104+
return new MarkdownExampleHelpInfo(name, code, output, description);
100105
}).ToArray();
101106
}
102107
}
@@ -154,12 +159,14 @@ internal class MarkdownExampleHelpInfo
154159
{
155160
public string Name { get; }
156161
public string Code { get; }
162+
public string Output { get; }
157163
public string Description { get; }
158164

159-
public MarkdownExampleHelpInfo(string name, string code, string description)
165+
public MarkdownExampleHelpInfo(string name, string code, string output, string description)
160166
{
161167
Name = name;
162168
Code = code;
169+
Output = output;
163170
Description = description;
164171
}
165172
}
@@ -213,12 +220,12 @@ public MarkdownParameterHelpInfo(PsParameterHelpInfo[] parameterHelpInfos, Param
213220

214221
internal static class MarkdownTypesExtensions
215222
{
216-
public static MarkdownExampleHelpInfo ToExampleHelpInfo(this PsHelpExampleInfo exampleInfo) => new MarkdownExampleHelpInfo(exampleInfo.Title, exampleInfo.Code, exampleInfo.Remarks);
223+
public static MarkdownExampleHelpInfo ToExampleHelpInfo(this PsHelpExampleInfo exampleInfo) => new MarkdownExampleHelpInfo(exampleInfo.Title, exampleInfo.Code, exampleInfo.Output, exampleInfo.Remarks);
217224

218225
public static MarkdownExampleHelpInfo[] DefaultExampleHelpInfos =
219226
{
220-
new MarkdownExampleHelpInfo("Example 1: {{ Add title here }}", $@"PS C:\> {{{{ Add code here }}}}{Environment.NewLine}{Environment.NewLine}{{{{ Add output here }}}}", @"{{ Add description here }}"),
221-
new MarkdownExampleHelpInfo("Example 2: {{ Add title here }}", $@"PS C:\> {{{{ Add code here }}}}{Environment.NewLine}{Environment.NewLine}{{{{ Add output here }}}}", @"{{ Add description here }}")
227+
new MarkdownExampleHelpInfo("Example 1: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here }}}}", @"{{ Add description here }}"),
228+
new MarkdownExampleHelpInfo("Example 2: {{ Add title here }}", $@"{{{{ Add code here }}}}", $@"{{{{ Add output here }}}}", @"{{ Add description here }}"),
222229
};
223230

224231
public static MarkdownParameterHelpInfo[] SupportsShouldProcessParameters =

src/Resources/MSGraph.Autorest/create-model-cmdlets.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function CreateModelCmdlet {
2323
}
2424

2525
$ModelCsPath = Join-Path (Join-Path $PSScriptRoot 'generated\api') 'Models'
26-
$ModuleName = 'Az.MSGraph'.Split(".")[1]
26+
$ModuleName = 'AD'
2727
$OutputDir = Join-Path $PSScriptRoot 'custom\autogen-model-cmdlets'
2828
$null = New-Item -ItemType Directory -Force -Path $OutputDir
2929

@@ -115,7 +115,9 @@ function CreateModelCmdlet {
115115
# check whether completer is needed
116116
$completer = '';
117117
if($Type.Split('.').Split('.')[-2] -eq 'Support') {
118-
$completer += "`n [ArgumentCompleter([${Type}])]"
118+
# If Type is an array, need to strip []
119+
$strippedType = $Type.Replace('[]', '')
120+
$completer += "`n [ArgumentCompleter([${strippedType}])]"
119121
}
120122
$ParameterDefineScript = "
121123
[Parameter($ParameterDefineProperty)]${completer}

src/Resources/MSGraph.Autorest/custom/New-AzADServicePrincipal.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ function New-AzADServicePrincipal {
302302
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphApplication]
303303
${ApplicationObject},
304304

305-
[Parameter(ParameterSetName = 'SimpleParameterSet')]
305+
[Parameter(ParameterSetName = 'ApplicationIdParameterSet')]
306306
[Alias('AppId')]
307307
[Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Category('Body')]
308308
[System.Guid]

src/Resources/MSGraph.Autorest/docs/Add-AzADAppPermission.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ User needs to grant consent via Azure Portal if the permission requires admin co
4141

4242
### Example 1: Add API Permission
4343
```powershell
44-
PS C:\> Add-AzADAppPermission -ObjectId 9cc74d5e-1162-4b90-8696-65f3d6a3f7d0 -ApiId 00000003-0000-0000-c000-000000000000 -PermissionId 5f8c59db-677d-491f-a6b8-5f174b11ec1d
44+
Add-AzADAppPermission -ObjectId 9cc74d5e-1162-4b90-8696-65f3d6a3f7d0 -ApiId 00000003-0000-0000-c000-000000000000 -PermissionId 5f8c59db-677d-491f-a6b8-5f174b11ec1d
4545
```
4646

4747
Add delegated permission "Group.Read.All" of Microsoft Graph API to AD Application (9cc74d5e-1162-4b90-8696-65f3d6a3f7d0)
4848

4949
### Example 2: Add API Permission
5050
```powershell
51-
PS C:\> Add-AzADAppPermission -ObjectId 9cc74d5e-1162-4b90-8696-65f3d6a3f7d0 -ApiId 00000003-0000-0000-c000-000000000000 -PermissionId 1138cb37-bd11-4084-a2b7-9f71582aeddb -Type Role
51+
Add-AzADAppPermission -ObjectId 9cc74d5e-1162-4b90-8696-65f3d6a3f7d0 -ApiId 00000003-0000-0000-c000-000000000000 -PermissionId 1138cb37-bd11-4084-a2b7-9f71582aeddb -Type Role
5252
```
5353

5454
Add application permission "Device.ReadWrite.All" of Microsoft Graph API to AD Application (9cc74d5e-1162-4b90-8696-65f3d6a3f7d0)

src/Resources/MSGraph.Autorest/docs/Add-AzADGroupMember.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ Adds member to group.
5555

5656
### Example 1: Add members to group
5757
```powershell
58-
PS C:\> $groupid=(Get-AzADGroup -DisplayName $gname).Id
59-
PS C:\> $members=@()
60-
PS C:\> $members+=(Get-AzADUser -DisplayName $uname).Id
61-
PS C:\> $members+=(Get-AzADServicePrincipal -ApplicationId $appid).Id
62-
PS C:\> Add-AzADGroupMember -TargetGroupObjectId $groupid MemberObjectId $members
58+
$groupid=(Get-AzADGroup -DisplayName $gname).Id
59+
$members=@()
60+
$members+=(Get-AzADUser -DisplayName $uname).Id
61+
$members+=(Get-AzADServicePrincipal -ApplicationId $appid).Id
62+
Add-AzADGroupMember -TargetGroupObjectId $groupid MemberObjectId $members
6363
```
6464

6565
Add members to group

src/Resources/MSGraph.Autorest/docs/Az.MSGraph.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
Module Name: Az.MSGraph
3-
Module Guid: 0fcdc3b3-bb14-4092-a847-d0cd87a0c25a
3+
Module Guid: 83719ae4-38f9-45c2-a9ca-6c45cdeffee4
44
Download Help Link: https://docs.microsoft.com/powershell/module/az.msgraph
55
Help Version: 1.0.0.0
66
Locale: en-US

src/Resources/MSGraph.Autorest/docs/Get-AzADAppCredential.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Lists key credentials and password credentials for an application.
4343

4444
### Example 1: List credentials from application by display name
4545
```powershell
46-
PS C:\> Get-AzADAppCredential -DisplayName $name
46+
Get-AzADAppCredential -DisplayName $name
4747
```
4848

4949
List credentials from application by display name

src/Resources/MSGraph.Autorest/docs/Get-AzADAppPermission.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ Lists API permissions the application has requested.
2929

3030
### Example 1: Get API permission
3131
```powershell
32-
PS C:\> Get-AzADAppPermission -ObjectId 18797549-86a9-4906-b2a9-54f08cd3c427
32+
Get-AzADAppPermission -ObjectId 18797549-86a9-4906-b2a9-54f08cd3c427
33+
```
3334

35+
```output
3436
ApiId Id Type
3537
----- -- ----
3638
00000003-0000-0000-c000-000000000000 df021288-bdef-4463-88db-98f22de89214 Scope

src/Resources/MSGraph.Autorest/docs/Get-AzADApplication.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,28 @@ Lists entities from applications or get entity from applications by key
5656

5757
### Example 1: Get application by display name
5858
```powershell
59-
PS C:\> Get-AzADApplication -DisplayName $appname
59+
Get-AzADApplication -DisplayName $appname
6060
```
6161

6262
Get application by display name
6363

6464
### Example 2: List applications
6565
```powershell
66-
PS C:\> Get-AzADApplication -First 10
66+
Get-AzADApplication -First 10
6767
```
6868

6969
List first 10 applications
7070

7171
### Example 3: Search for application display name starts with
7272
```powershell
73-
PS C:\> Get-AzADApplication -DisplayNameStartsWith $prefix
73+
Get-AzADApplication -DisplayNameStartsWith $prefix
7474
```
7575

7676
Search for application display name starts with
7777

7878
### Example 4: Get application by object Id
7979
```powershell
80-
PS C:\> Get-AzADapplication -ObjectId $id -Select Tags -AppendSelected
80+
Get-AzADapplication -ObjectId $id -Select Tags -AppendSelected
8181
```
8282

8383
Get application by object Id and append property 'Tags' after default properties: 'DisplayName', 'Id', 'DeletedDateTime', 'IdentifierUris', 'Web', 'AppId', 'SignInAudience'

src/Resources/MSGraph.Autorest/docs/Get-AzADGroup.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,21 @@ Lists entities from groups or get entity from groups by key
4545

4646
### Example 1: Get group by display name
4747
```powershell
48-
PS C:\> Get-AzADGroup -DisplayName $gname
48+
Get-AzADGroup -DisplayName $gname
4949
```
5050

5151
Get group by display name
5252

5353
### Example 2: List groups
5454
```powershell
55-
PS C:\> Get-AzADGroup -First 10
55+
Get-AzADGroup -First 10
5656
```
5757

5858
List first 10 groups
5959

6060
### Example 3: Get group by object id
6161
```powershell
62-
PS C:\> Get-AzADGroup -ObjectId $id -Select groupTypes -AppendSelected
62+
Get-AzADGroup -ObjectId $id -Select groupTypes -AppendSelected
6363
```
6464

6565
Get group by object id and append property 'groupTypes' after default properties: 'DisplayName', 'Id', 'DeletedDateTime', 'SecurityEnabled', 'MailEnabled', 'MailNickname', 'Description'

src/Resources/MSGraph.Autorest/docs/Get-AzADGroupMember.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ Lists members from group.
4040

4141
### Example 1: List members by group display name
4242
```powershell
43-
PS C:\> Get-AzADGroupMember -GroupDisplayName $name
43+
Get-AzADGroupMember -GroupDisplayName $name
4444
```
4545

4646
List members by group display name
4747

4848
### Example 2: List members by pipeline input
4949
```powershell
50-
PS C:\> Get-AzADGroup -DisplayName $name | Get-AzADGroupMember
50+
Get-AzADGroup -DisplayName $name | Get-AzADGroupMember
5151
```
5252

5353
List members by pipeline input

0 commit comments

Comments
 (0)