Skip to content

Commit 3baf813

Browse files
authored
Merge branch 'network-april' into netApril
2 parents 29567d0 + a77ac85 commit 3baf813

File tree

11 files changed

+379
-0
lines changed

11 files changed

+379
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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.Network.Test.ScenarioTests;
16+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
17+
using Xunit;
18+
19+
namespace Commands.Network.Test.ScenarioTests
20+
{
21+
public class NetworkServiceTagsTests : NetworkTestRunner
22+
{
23+
public NetworkServiceTagsTests(Xunit.Abstractions.ITestOutputHelper output)
24+
: base(output)
25+
{
26+
}
27+
28+
[Fact]
29+
[Trait(Category.AcceptanceType, Category.CheckIn)]
30+
[Trait(Category.Owner, NrpTeamAlias.sdnnrp)]
31+
public void TestNetworkServiceTagsList()
32+
{
33+
TestRunner.RunTestScript( "Test-NetworkServiceTagsList");
34+
}
35+
}
36+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
<#
16+
.SYNOPSIS
17+
Tests checking API to list service tags.
18+
#>
19+
function Test-NetworkServiceTagsList
20+
{
21+
$location = Get-ProviderLocation ResourceManagement;
22+
23+
try
24+
{
25+
$results = Get-AzNetworkServiceTag -Location $location;
26+
Assert-NotNull $results;
27+
28+
Assert-AreEqual $results.Type "Microsoft.Network/serviceTags";
29+
Assert-NotNull $results.Name;
30+
Assert-NotNull $results.Id;
31+
Assert-NotNull $results.ChangeNumber;
32+
Assert-NotNull $results.Cloud;
33+
Assert-NotNull $results.Values;
34+
Assert-True { $results.Values.Count -gt 1 };
35+
36+
$serviceTagInformation = $results.Values[0];
37+
38+
Assert-NotNull $serviceTagInformation.Name;
39+
Assert-NotNull $serviceTagInformation.Id;
40+
Assert-NotNull $serviceTagInformation.Properties.ChangeNumber;
41+
Assert-NotNull $serviceTagInformation.Properties.Region;
42+
Assert-NotNull $serviceTagInformation.Properties.SystemService;
43+
Assert-True { $serviceTagInformation.Properties.AddressPrefixes.Count -gt 1 };
44+
}
45+
finally {}
46+
}

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.NetworkServiceTagsTests/TestNetworkServiceTagsList.json

Lines changed: 72 additions & 0 deletions
Large diffs are not rendered by default.

src/Network/Network/Az.Network.psd1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ CmdletsToExport = 'Add-AzApplicationGatewayAuthenticationCertificate',
396396
'Get-AzExpressRouteCrossConnectionRouteTableSummary',
397397
'Get-AzNatGateway', 'New-AzNatGateway', 'Remove-AzNatGateway',
398398
'Set-AzNatGateway',
399+
'Get-AzNetworkServiceTag',
399400
'New-AzPrivateEndpoint', 'Get-AzPrivateEndpoint', 'Remove-AzPrivateEndpoint',
400401
'New-AzPrivateLinkServiceConnection',
401402
'New-AzPrivateLinkService', 'Get-AzPrivateLinkService', 'Remove-AzPrivateLinkService',

src/Network/Network/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
* Fixed Cortex Get cmdlets for list all part
4949
* Fixed VirtualHub reference creation for ExpressRouteGateways, VpnGateway
5050
* Added support for Availability Zones in AzureFirewall and NatGateway
51+
* Added cmdlet Get-AzNetworkServiceTag
5152

5253
## Version 1.8.1
5354
* Add DisableBgpRoutePropagation flag to Effective Route Table output
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//
2+
// Copyright (c) Microsoft. All rights reserved.
3+
//
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+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
using System.Collections.Generic;
17+
18+
namespace Microsoft.Azure.Commands.Network.Models
19+
{
20+
public class PSNetworkServiceTag
21+
{
22+
public string Name { get; set; }
23+
24+
public string Id { get; set; }
25+
26+
public string Type { get; set; }
27+
28+
public string Cloud { get; set; }
29+
30+
public string ChangeNumber { get; set; }
31+
32+
public List<PSNetworkServiceTagInformation> Values { get; set; }
33+
}
34+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//
2+
// Copyright (c) Microsoft. All rights reserved.
3+
//
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+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
namespace Microsoft.Azure.Commands.Network.Models
17+
{
18+
public class PSNetworkServiceTagInformation
19+
{
20+
public string Name { get; set; }
21+
22+
public string Id { get; set; }
23+
24+
public PSNetworkServiceTagInformationProperties Properties { get; set; }
25+
}
26+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// Copyright (c) Microsoft. All rights reserved.
3+
//
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+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
using System.Collections.Generic;
17+
18+
namespace Microsoft.Azure.Commands.Network.Models
19+
{
20+
public class PSNetworkServiceTagInformationProperties
21+
{
22+
public string Region { get; set; }
23+
24+
public string SystemService { get; set; }
25+
26+
public string ChangeNumber { get; set; }
27+
28+
public List<string> AddressPrefixes { get; set; }
29+
}
30+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//
2+
// Copyright (c) Microsoft and contributors. All rights reserved.
3+
//
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+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
//
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
//
16+
17+
using System.Collections.Generic;
18+
using System.Management.Automation;
19+
using Microsoft.Azure.Commands.Network.Models;
20+
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
21+
using Microsoft.Azure.Management.Network;
22+
using CNM = Microsoft.Azure.Commands.Network.Models;
23+
24+
namespace Microsoft.Azure.Commands.Network.Automation
25+
{
26+
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "NetworkServiceTag"), OutputType(typeof(PSNetworkServiceTag))]
27+
public partial class GetAzureNetworkServiceTagCommand : NetworkBaseCmdlet
28+
{
29+
[Parameter(
30+
Mandatory = true,
31+
HelpMessage = "The location.",
32+
ValueFromPipelineByPropertyName = true)]
33+
[LocationCompleter("Microsoft.Network/locations/serviceTags")]
34+
[ValidateNotNullOrEmpty]
35+
public string Location { get; set; }
36+
37+
public override void Execute()
38+
{
39+
base.Execute();
40+
41+
var serviceTagsList = this.NetworkClient.NetworkManagementClient.ServiceTags.List(Location);
42+
PSNetworkServiceTag psNetworkServiceTag = NetworkResourceManagerProfile.Mapper.Map<CNM.PSNetworkServiceTag>(serviceTagsList);
43+
44+
WriteObject(psNetworkServiceTag, true);
45+
}
46+
}
47+
}

src/Network/Network/help/Az.Network.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,9 @@ Gets a network security group.
350350
### [Get-AzNetworkSecurityRuleConfig](Get-AzNetworkSecurityRuleConfig.md)
351351
Get a network security rule configuration for a network security group.
352352

353+
### [Get-AzNetworkServiceTag](Get-AzNetworkServiceTag.md)
354+
Gets the list of service tag information resources.
355+
353356
### [Get-AzNetworkUsage](Get-AzNetworkUsage.md)
354357
Lists network usages for a subscription
355358

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
external help file: Microsoft.Azure.PowerShell.Cmdlets.Network.dll-Help.xml
3+
Module Name: Az.Network
4+
online version: https://docs.microsoft.com/en-us/powershell/module/az.network/get-aznetworkservicetag
5+
schema: 2.0.0
6+
---
7+
8+
# Get-AzNetworkServiceTag
9+
10+
## SYNOPSIS
11+
Gets the list of service tag information resources.
12+
13+
## SYNTAX
14+
15+
```
16+
Get-AzNetworkServiceTag -Location <String> [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
17+
```
18+
19+
## DESCRIPTION
20+
The **Get-AzNetworkServiceTag** cmdlet gets the list of service tag information resources.
21+
22+
## EXAMPLES
23+
24+
### Example 1
25+
```powershell
26+
PS C:\> Get-AzNetworkServiceTag -Location eastus2
27+
28+
Name : Public
29+
Id : /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx/providers/Microsoft.Network/serviceTags/Public
30+
Type : Microsoft.Network/serviceTags
31+
ChangeNumber : 63
32+
Cloud : Public
33+
Values : {ApiManagement, ApiManagement.AustraliaCentral, ApiManagement.AustraliaCentral2, ApiManagement.AustraliaEast...}
34+
```
35+
36+
The command gets the list of service tag information resources.
37+
38+
## PARAMETERS
39+
40+
### -DefaultProfile
41+
The credentials, account, tenant, and subscription used for communication with Azure.
42+
43+
```yaml
44+
Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
45+
Parameter Sets: (All)
46+
Aliases: AzContext, AzureRmContext, AzureCredential
47+
48+
Required: False
49+
Position: Named
50+
Default value: None
51+
Accept pipeline input: False
52+
Accept wildcard characters: False
53+
```
54+
55+
### -Location
56+
The location.
57+
58+
```yaml
59+
Type: System.String
60+
Parameter Sets: (All)
61+
Aliases:
62+
63+
Required: True
64+
Position: Named
65+
Default value: None
66+
Accept pipeline input: True (ByPropertyName)
67+
Accept wildcard characters: False
68+
```
69+
70+
### CommonParameters
71+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
72+
73+
## INPUTS
74+
75+
### System.String
76+
77+
## OUTPUTS
78+
79+
### Microsoft.Azure.Commands.Network.Models.PSNetworkServiceTag
80+
81+
## NOTES
82+
83+
## RELATED LINKS

0 commit comments

Comments
 (0)