Skip to content

Commit 766d1c8

Browse files
janielMartelljanielm
and
janielm
authored
Restoring Az.CodeSigning (#27262)
Co-authored-by: janielm <[email protected]>
1 parent 95897f5 commit 766d1c8

39 files changed

+5422
-0
lines changed

documentation/azure-powershell-modules.md

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
| Content Delivery Network | `Az.Cdn` | [![Cdn]][CdnGallery] | [Changelog][CdnChangeLog] |
3939
| Change Analysis | `Az.ChangeAnalysis` | [![ChangeAnalysis]][ChangeAnalysisGallery] | [Changelog][ChangeAnalysisChangeLog] |
4040
| Cloud Service | `Az.CloudService` | [![CloudService]][CloudServiceGallery] | [Changelog][CloudServiceChangeLog] |
41+
| CodeSigning | `Az.CodeSigning` | [![CodeSigning]][CodeSigningGallery] | [Changelog][CodeSigningChangeLog] |
4142
| Cognitive Services | `Az.CognitiveServices` | [![CognitiveServices]][CognitiveServicesGallery] | [Changelog][CognitiveServicesChangeLog] |
4243
| Communication | `Az.Communication` | [![Communication]][CommunicationGallery] | [Changelog][CommunicationChangeLog] |
4344
| Compute | `Az.Compute` | [![Compute]][ComputeGallery] | [Changelog][ComputeChangeLog] |
@@ -224,6 +225,7 @@
224225
[Cdn]: https://img.shields.io/powershellgallery/v/Az.Cdn.svg?style=flat-square&label=Az.Cdn
225226
[ChangeAnalysis]: https://img.shields.io/powershellgallery/v/Az.ChangeAnalysis.svg?style=flat-square&label=Az.ChangeAnalysis
226227
[CloudService]: https://img.shields.io/powershellgallery/v/Az.CloudService.svg?style=flat-square&label=Az.CloudService
228+
[CodeSigning]: https://img.shields.io/powershellgallery/v/Az.CodeSigning.svg?style=flat-square&label=Az.CodeSigning
227229
[CognitiveServices]: https://img.shields.io/powershellgallery/v/Az.CognitiveServices.svg?style=flat-square&label=Az.CognitiveServices
228230
[Communication]: https://img.shields.io/powershellgallery/v/Az.Communication.svg?style=flat-square&label=Az.Communication
229231
[Compute]: https://img.shields.io/powershellgallery/v/Az.Compute.svg?style=flat-square&label=Az.Compute
@@ -406,6 +408,7 @@
406408
[CdnGallery]: https://www.powershellgallery.com/packages/Az.Cdn/
407409
[ChangeAnalysisGallery]: https://www.powershellgallery.com/packages/Az.ChangeAnalysis/
408410
[CloudServiceGallery]: https://www.powershellgallery.com/packages/Az.CloudService/
411+
[CodeSigningGallery]: https://www.powershellgallery.com/packages/Az.CodeSigning/
409412
[CognitiveServicesGallery]: https://www.powershellgallery.com/packages/Az.CognitiveServices/
410413
[CommunicationGallery]: https://www.powershellgallery.com/packages/Az.Communication/
411414
[ComputeGallery]: https://www.powershellgallery.com/packages/Az.Compute/
@@ -586,6 +589,7 @@
586589
[CdnChangeLog]: ../src/Cdn/Cdn/ChangeLog.md
587590
[ChangeAnalysisChangeLog]: ../src/ChangeAnalysis/ChangeAnalysis/ChangeLog.md
588591
[CloudServiceChangeLog]: ../src/CloudService/CloudService/ChangeLog.md
592+
[CodeSigningChangeLog]: ../src/CodeSigning/CodeSigning/ChangeLog.md
589593
[CognitiveServicesChangeLog]: ../src/CognitiveServices/CognitiveServices/ChangeLog.md
590594
[CommunicationChangeLog]: ../src/Communication/Communication/ChangeLog.md
591595
[ComputeChangeLog]: ../src/Compute/Compute/ChangeLog.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<PsModuleName>CodeSigning</PsModuleName>
5+
</PropertyGroup>
6+
7+
<Import Project="$(MSBuildThisFileDirectory)..\..\Az.Test.props" />
8+
9+
<PropertyGroup>
10+
<RootNamespace>$(LegacyAssemblyPrefix)$(PsModuleName)$(AzTestAssemblySuffix)</RootNamespace>
11+
</PropertyGroup>
12+
13+
<ItemGroup>
14+
<Compile Remove="Models\**" />
15+
<Compile Remove="Resources\**" />
16+
<Compile Remove="Scripts\**" />
17+
<Compile Remove="SessionRecords\**" />
18+
<EmbeddedResource Remove="Models\**" />
19+
<EmbeddedResource Remove="Resources\**" />
20+
<EmbeddedResource Remove="Scripts\**" />
21+
<EmbeddedResource Remove="SessionRecords\**" />
22+
<None Remove="Models\**" />
23+
<None Remove="Resources\**" />
24+
<None Remove="Scripts\**" />
25+
<None Remove="SessionRecords\**" />
26+
</ItemGroup>
27+
28+
<ItemGroup>
29+
<ProjectReference Include="..\CodeSigning\CodeSigning.csproj" />
30+
</ItemGroup>
31+
32+
<ItemGroup>
33+
<Folder Include="ScenarioTests\" />
34+
</ItemGroup>
35+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<root>
3+
<!--
4+
Microsoft ResX Schema
5+
6+
Version 2.0
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
12+
13+
Example:
14+
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">2.0</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
<value>[base64 mime encoded serialized .NET Framework object]</value>
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27+
<comment>This is a comment</comment>
28+
</data>
29+
30+
There are any number of "resheader" rows that contain simple
31+
name/value pairs.
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
37+
mimetype set.
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
41+
extensible. For a given mimetype the value must be set accordingly:
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
45+
read any of the formats listed below.
46+
47+
mimetype: application/x-microsoft.net.object.binary.base64
48+
value : The object must be serialized with
49+
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50+
: and then encoded with base64 encoding.
51+
52+
mimetype: application/x-microsoft.net.object.soap.base64
53+
value : The object must be serialized with
54+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55+
: and then encoded with base64 encoding.
56+
57+
mimetype: application/x-microsoft.net.object.bytearray.base64
58+
value : The object must be serialized into a byte array
59+
: using a System.ComponentModel.TypeConverter
60+
: and then encoded with base64 encoding.
61+
-->
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64+
<xsd:element name="root" msdata:IsDataSet="true">
65+
<xsd:complexType>
66+
<xsd:choice maxOccurs="unbounded">
67+
<xsd:element name="metadata">
68+
<xsd:complexType>
69+
<xsd:sequence>
70+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
71+
</xsd:sequence>
72+
<xsd:attribute name="name" use="required" type="xsd:string" />
73+
<xsd:attribute name="type" type="xsd:string" />
74+
<xsd:attribute name="mimetype" type="xsd:string" />
75+
<xsd:attribute ref="xml:space" />
76+
</xsd:complexType>
77+
</xsd:element>
78+
<xsd:element name="assembly">
79+
<xsd:complexType>
80+
<xsd:attribute name="alias" type="xsd:string" />
81+
<xsd:attribute name="name" type="xsd:string" />
82+
</xsd:complexType>
83+
</xsd:element>
84+
<xsd:element name="data">
85+
<xsd:complexType>
86+
<xsd:sequence>
87+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89+
</xsd:sequence>
90+
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93+
<xsd:attribute ref="xml:space" />
94+
</xsd:complexType>
95+
</xsd:element>
96+
<xsd:element name="resheader">
97+
<xsd:complexType>
98+
<xsd:sequence>
99+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100+
</xsd:sequence>
101+
<xsd:attribute name="name" type="xsd:string" use="required" />
102+
</xsd:complexType>
103+
</xsd:element>
104+
</xsd:choice>
105+
</xsd:complexType>
106+
</xsd:element>
107+
</xsd:schema>
108+
<resheader name="resmimetype">
109+
<value>text/microsoft-resx</value>
110+
</resheader>
111+
<resheader name="version">
112+
<value>2.0</value>
113+
</resheader>
114+
<resheader name="reader">
115+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116+
</resheader>
117+
<resheader name="writer">
118+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119+
</resheader>
120+
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
121+
</root>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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.TestFx;
16+
using Xunit.Abstractions;
17+
18+
namespace Microsoft.Azure.Commands.CodeSigning.Test.ScenarioTests
19+
{
20+
public class CodeSigningTestRunner
21+
{
22+
protected readonly ITestRunner TestRunner;
23+
24+
protected CodeSigningTestRunner(ITestOutputHelper output)
25+
{
26+
TestRunner = TestManager.CreateInstance(output)
27+
.WithNewPsScriptFilename($"{GetType().Name}.ps1")
28+
.WithProjectSubfolderForTests("ScenarioTests")
29+
.WithCommonPsScripts(new[]
30+
{
31+
@"../AzureRM.Resources.ps1"
32+
})
33+
.WithNewRmModules(helper => new[]
34+
{
35+
helper.RMProfileModule,
36+
helper.GetRMModulePath("Az.CodeSigning.psd1"),
37+
})
38+
.Build();
39+
}
40+
}
41+
}
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.WindowsAzure.Commands.ScenarioTest;
16+
using Xunit;
17+
18+
namespace Microsoft.Azure.Commands.CodeSigning.Test.ScenarioTests
19+
{
20+
public class CodeSigningTests: CodeSigningTestRunner
21+
{
22+
public CodeSigningTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
23+
{
24+
}
25+
26+
[Fact]
27+
[Trait(Category.AcceptanceType, Category.LiveOnly)]
28+
public void TestCodeSigningEku()
29+
{
30+
TestRunner.RunTestScript("Test-CodeSigningEku");
31+
}
32+
33+
[Fact]
34+
[Trait(Category.AcceptanceType, Category.LiveOnly)]
35+
public void TestGetSigningRootCertificate()
36+
{
37+
TestRunner.RunTestScript("Test-GetCodeSigningRootCert");
38+
}
39+
40+
[Fact]
41+
[Trait(Category.AcceptanceType, Category.LiveOnly)]
42+
public void TestGetSigningCertificateChain()
43+
{
44+
TestRunner.RunTestScript("Test-GetCodeSigningCertChain");
45+
}
46+
}
47+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
Test codesigning command to get extended key usage from the certificate profile
18+
#>
19+
function Test-CodeSigningEku {
20+
21+
$accountName = "acs-test-account"
22+
$profileName = "acs-test-account-ci"
23+
$endPointUrl = "https://scus.codesigning.azure.net/"
24+
$expectedEku = "1.3.6.1.4.1.311.97.1.3.1.29433.35007.34545.16815.37291.11644.53265.56135,1.3.6.1.4.1.311.97.1.4.1.29433.35007.34545.16815.37291.11644.53265.56135"
25+
26+
try {
27+
# Test Get CodeSigning Eku
28+
$eku = Get-AzCodeSigningCustomerEku -AccountName $accountName -ProfileName $profileName -EndpointUrl $endPointUrl
29+
Assert-AreEqual $eku $expectedEku
30+
}
31+
32+
finally {
33+
34+
}
35+
}
36+
37+
<#
38+
.SYNOPSIS
39+
Test codesigning command to get the root certificate from the certificate profile
40+
#>
41+
function Test-GetCodeSigningRootCert {
42+
$accountName = "acs-test-account"
43+
$profileName = "acs-test-account-ci"
44+
$endPointUrl = "https://scus.codesigning.azure.net/"
45+
$destination = "C:\temp"
46+
47+
try {
48+
# Test Get CodeSigning Root Cert
49+
$cert = Get-AzCodeSigningRootCert -AccountName $accountName -ProfileName $profileName -EndpointUrl $endPointUrl -Destination $destination
50+
Assert-NotNullOrEmpty $cert
51+
}
52+
53+
finally {
54+
55+
}
56+
}
57+
58+
<#
59+
.SYNOPSIS
60+
Test codesigning command to get the certificate chain from the certificate profile
61+
#>
62+
function Test-GetCodeSigningCertChain {
63+
$accountName = "acs-test-account"
64+
$profileName = "acs-test-account-ci"
65+
$endPointUrl = "https://scus.codesigning.azure.net/"
66+
$destination = "C:\temp"
67+
68+
try {
69+
# Test Get CodeSigning Certificate Chain
70+
$chain = Get-AzCodeSigningCertChain -AccountName $accountName -ProfileName $profileName -EndpointUrl $endPointUrl -Destination $destination
71+
Assert-NotNullOrEmpty $chain
72+
}
73+
74+
finally {
75+
76+
}
77+
}

0 commit comments

Comments
 (0)