Skip to content

Commit 2999f3c

Browse files
committed
merge master changes
2 parents 090ba43 + 4d6bd37 commit 2999f3c

File tree

221 files changed

+53168
-3300
lines changed

Some content is hidden

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

221 files changed

+53168
-3300
lines changed

.github/ISSUE_TEMPLATE/az-module-bug-report.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ assignees: ''
2929

3030
## Environment data
3131

32-
<!-- Please run $PSVersionTable and paste the output in the below code block -->
32+
<!-- Please run $PSVersionTable and paste the output in the below code block
33+
If running the Docker container image, indicate the tag of the image used and the version of Docker engine-->
3334

3435
```
3536

Dockerfile

Lines changed: 0 additions & 6 deletions
This file was deleted.

build.proj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@
6363
<OnPremiseBuild Condition="!Exists($(OnPremiseBuildTasks))">false</OnPremiseBuild>
6464
<!-- CISignRepo is an environment variable that points to ci-signing repo clone -->
6565
<CISignRepoPath>$(CISignRepo)</CISignRepoPath>
66+
67+
<!-- Docker related -->
68+
<DockerRoot>$(RepoRoot)docker</DockerRoot>
69+
<DockerTools>$(RepoTools)Docker</DockerTools>
70+
<DockerImageName Condition="'$(DockerImageName)' == ''">azure-powershell</DockerImageName>
6671
</PropertyGroup>
6772

6873
<!-- Tasks -->
@@ -237,6 +242,12 @@
237242
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;. Unregister-PSRepository -Name MSIcreationrepository &quot;" />
238243
</Target>
239244

245+
<Target Name="BuildImages">
246+
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;. $(DockerTools)/GetArtifacts.ps1 -Artifacts $(RepoArtifacts) -Docker $(DockerRoot) &quot;" />
247+
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;. $(DockerTools)/BuildImages.ps1 -DOCKER $(DockerRoot) -DockerImageName $(DockerImageName) &quot;" />
248+
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;. $(DockerTools)/CleanArtifacts.ps1 -Docker $(DockerRoot) &quot;" />
249+
</Target>
250+
240251
<Target Name="Test">
241252
<Message Importance="high" Text="Running check in tests..." />
242253
<MakeDir Directories="$(TestOutputDirectory)" ContinueOnError="false" />

docker/Dockerfile-centos-7

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
FROM mcr.microsoft.com/powershell:centos-7
2+
3+
ARG ARTIFACTS=/tmp/artifacts/
4+
ARG ARTIFACT=*.nupkg
5+
ARG TEMPREPO=tmp
6+
ARG MODULE=Az
7+
ARG CONFIG=config
8+
ARG AZURERM_CONTEXT_SETTINGS=AzureRmContextSettings.json
9+
ARG AZURE=/root/.Azure
10+
ARG VCS_REF="none"
11+
ARG Build_Date=
12+
ARG VERSION=
13+
ARG IMAGE_NAME=mcr.microsoft.com/azure-powershell:${VERSION}-centos-7
14+
15+
ENV AZUREPS_HOST_ENVIRONMENT="dockerImage/${VERSION}-centos-7"
16+
17+
LABEL maintainer="Azure PowerShell Team <[email protected]>" \
18+
readme.md="http://aka.ms/azpsdockerreadme" \
19+
description="This Dockerfile will install the latest release of Azure PowerShell." \
20+
org.label-schema.build-date=${Build_Date} \
21+
org.label-schema.usage="http://aka.ms/azpsdocker" \
22+
org.label-schema.url="http://aka.ms/azpsdockerreadme" \
23+
org.label-schema.vcs-url="https://github.com/Azure/azure-powershell" \
24+
org.label-schema.name="azure powershell" \
25+
org.label-schema.vendor="Azure PowerShell" \
26+
org.label-schema.version=${VERSION} \
27+
org.label-schema.schema-version="1.0" \
28+
org.label-schema.vcs-ref=${VCS_REF} \
29+
org.label-schema.docker.cmd="docker run --rm ${IMAGE_NAME} pwsh -c '\$PSVERSIONTABLE'" \
30+
org.label-schema.docker.cmd.devel="docker run -it --rm -e 'DebugPreference=Continue' ${IMAGE_NAME} pwsh" \
31+
org.label-schema.docker.cmd.test="currently not available" \
32+
org.label-schema.docker.cmd.help="docker run --rm ${IMAGE_NAME} pwsh -c Get-Help"
33+
34+
# install azure-powershell from built artifacts
35+
COPY ${ARTIFACT} ${ARTIFACTS}
36+
RUN pwsh -Command Register-PSRepository -Name ${TEMPREPO} -SourceLocation ${ARTIFACTS} -PublishLocation $ARTIFACTS -InstallationPolicy Trusted -PackageManagementProvider NuGet && \
37+
pwsh -Command Install-Module -Name ${MODULE} -Repository ${TEMPREPO} && \
38+
pwsh -Command Get-Module -ListAvailable && \
39+
pwsh -Command Unregister-PSRepository -Name ${TEMPREPO} && \
40+
pwsh -Command Remove-Item ${ARTIFACTS} -Recurse
41+
42+
# create AzureRmContextSettings.json before it was generated
43+
COPY ${CONFIG}/${AZURERM_CONTEXT_SETTINGS} ${AZURE}/${AZURERM_CONTEXT_SETTINGS}
44+
45+
CMD [ "pwsh" ]

docker/Dockerfile-debian-9

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
FROM mcr.microsoft.com/powershell:debian-9
2+
3+
ARG ARTIFACTS=/tmp/artifacts/
4+
ARG ARTIFACT=*.nupkg
5+
ARG TEMPREPO=tmp
6+
ARG MODULE=Az
7+
ARG CONFIG=config
8+
ARG AZURERM_CONTEXT_SETTINGS=AzureRmContextSettings.json
9+
ARG AZURE=/root/.Azure
10+
ARG VCS_REF="none"
11+
ARG Build_Date=
12+
ARG VERSION=
13+
ARG IMAGE_NAME=mcr.microsoft.com/azure-powershell:${VERSION}-debian-9
14+
15+
ENV AZUREPS_HOST_ENVIRONMENT="dockerImage/${VERSION}-debian-9"
16+
17+
LABEL maintainer="Azure PowerShell Team <[email protected]>" \
18+
readme.md="http://aka.ms/azpsdockerreadme" \
19+
description="This Dockerfile will install the latest release of Azure PowerShell." \
20+
org.label-schema.build-date=${Build_Date} \
21+
org.label-schema.usage="http://aka.ms/azpsdocker" \
22+
org.label-schema.url="http://aka.ms/azpsdockerreadme" \
23+
org.label-schema.vcs-url="https://github.com/Azure/azure-powershell" \
24+
org.label-schema.name="azure powershell" \
25+
org.label-schema.vendor="Azure PowerShell" \
26+
org.label-schema.version=${VERSION} \
27+
org.label-schema.schema-version="1.0" \
28+
org.label-schema.vcs-ref=${VCS_REF} \
29+
org.label-schema.docker.cmd="docker run --rm ${IMAGE_NAME} pwsh -c '\$PSVERSIONTABLE'" \
30+
org.label-schema.docker.cmd.devel="docker run -it --rm -e 'DebugPreference=Continue' ${IMAGE_NAME} pwsh" \
31+
org.label-schema.docker.cmd.test="currently not available" \
32+
org.label-schema.docker.cmd.help="docker run --rm ${IMAGE_NAME} pwsh -c Get-Help"
33+
34+
# install azure-powershell from built artifacts
35+
COPY ${ARTIFACT} ${ARTIFACTS}
36+
RUN pwsh -Command Register-PSRepository -Name ${TEMPREPO} -SourceLocation ${ARTIFACTS} -PublishLocation $ARTIFACTS -InstallationPolicy Trusted -PackageManagementProvider NuGet && \
37+
pwsh -Command Install-Module -Name ${MODULE} -Repository ${TEMPREPO} && \
38+
pwsh -Command Get-Module -ListAvailable && \
39+
pwsh -Command Unregister-PSRepository -Name ${TEMPREPO} && \
40+
pwsh -Command Remove-Item ${ARTIFACTS} -Recurse
41+
42+
# create AzureRmContextSettings.json before it was generated
43+
COPY ${CONFIG}/${AZURERM_CONTEXT_SETTINGS} ${AZURE}/${AZURERM_CONTEXT_SETTINGS}
44+
45+
CMD [ "pwsh" ]

docker/Dockerfile-ubuntu-18.04

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
FROM mcr.microsoft.com/powershell:ubuntu-18.04
2+
3+
ARG ARTIFACTS=/tmp/artifacts/
4+
ARG ARTIFACT=*.nupkg
5+
ARG TEMPREPO=tmp
6+
ARG MODULE=Az
7+
ARG CONFIG=config
8+
ARG AZURERM_CONTEXT_SETTINGS=AzureRmContextSettings.json
9+
ARG AZURE=/root/.Azure
10+
ARG VCS_REF="none"
11+
ARG Build_Date=
12+
ARG VERSION=
13+
ARG IMAGE_NAME=mcr.microsoft.com/azure-powershell:${VERSION}-ubuntu-18.04
14+
15+
ENV AZUREPS_HOST_ENVIRONMENT="dockerImage/${VERSION}-ubuntu-18.04"
16+
17+
LABEL maintainer="Azure PowerShell Team <[email protected]>" \
18+
readme.md="http://aka.ms/azpsdockerreadme" \
19+
description="This Dockerfile will install the latest release of Azure PowerShell." \
20+
org.label-schema.build-date=${Build_Date} \
21+
org.label-schema.usage="http://aka.ms/azpsdocker" \
22+
org.label-schema.url="http://aka.ms/azpsdockerreadme" \
23+
org.label-schema.vcs-url="https://github.com/Azure/azure-powershell" \
24+
org.label-schema.name="azure powershell" \
25+
org.label-schema.vendor="Azure PowerShell" \
26+
org.label-schema.version=${VERSION} \
27+
org.label-schema.schema-version="1.0" \
28+
org.label-schema.vcs-ref=${VCS_REF} \
29+
org.label-schema.docker.cmd="docker run --rm ${IMAGE_NAME} pwsh -c '\$PSVERSIONTABLE'" \
30+
org.label-schema.docker.cmd.devel="docker run -it --rm -e 'DebugPreference=Continue' ${IMAGE_NAME} pwsh" \
31+
org.label-schema.docker.cmd.test="currently not available" \
32+
org.label-schema.docker.cmd.help="docker run --rm ${IMAGE_NAME} pwsh -c Get-Help"
33+
34+
# install azure-powershell from built artifacts
35+
COPY ${ARTIFACT} ${ARTIFACTS}
36+
RUN pwsh -Command Register-PSRepository -Name ${TEMPREPO} -SourceLocation ${ARTIFACTS} -PublishLocation $ARTIFACTS -InstallationPolicy Trusted -PackageManagementProvider NuGet && \
37+
pwsh -Command Install-Module -Name ${MODULE} -Repository ${TEMPREPO} && \
38+
pwsh -Command Get-Module -ListAvailable && \
39+
pwsh -Command Unregister-PSRepository -Name ${TEMPREPO} && \
40+
pwsh -Command Remove-Item ${ARTIFACTS} -Recurse
41+
42+
# create AzureRmContextSettings.json before it was generated
43+
COPY ${CONFIG}/${AZURERM_CONTEXT_SETTINGS} ${AZURE}/${AZURERM_CONTEXT_SETTINGS}
44+
45+
CMD [ "pwsh" ]

docker/README.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Docker
2+
3+
4+
## Overview
5+
These Dockerfiles enable executing Azure-PowerShell cmdlets in a container for the supported OS.
6+
7+
## Configuration
8+
This image requires Docker 17.05 or newer.
9+
10+
It is also expected that you are able to run Docker without `sudo`.
11+
Please follow [Docker's official instructions][install] to install `docker` correctly.
12+
13+
[install]: https://docs.docker.com/engine/installation/
14+
15+
16+
## Release
17+
18+
The release containers derive from the [Powershell image][powershell image], and then install the current Az package.
19+
20+
[powershell image]: https://hub.docker.com/_/microsoft-powershell
21+
22+
Azure PowerShell [release notes](https://docs.microsoft.com/en-us/powershell/azure/release-notes-azureps)
23+
24+
## Examples
25+
26+
### Download/Update the azure-powershell image
27+
28+
```sh
29+
docker pull mcr.microsoft.com/azure-powershell
30+
```
31+
32+
### Run azure-powershell container
33+
34+
- To run azure-powershell using a container in an interactive mode:
35+
36+
```sh
37+
$ docker run -it mcr.microsoft.com/azure-powershell pwsh
38+
```
39+
40+
- To run azure-powershell from using a container in an interactive mode using host authentication:
41+
42+
1- Make sure that `$HOME/.Azure` is present on the host (default location)
43+
2- You may need to grant access this location for the docker process.
44+
45+
```sh
46+
$ docker run -it -v ~/.Azure/AzureRmContext.json:/root/.Azure/AzureRmContext.json -v ~/.Azure/TokenCache.dat:/root/.Azure/TokenCache.dat mcr.microsoft.com/azure-powershell pwsh
47+
```
48+
49+
Verify the host authentication:
50+
51+
```sh
52+
docker run -it --rm -v ~/.Azure/AzureRmContext.json:/root/.Azure/AzureRmContext.json -v ~/.Azure/TokenCache.dat:/root/.Azure/TokenCache.dat mcr.microsoft.com/azure-powershell pwsh -c Get-AzContext
53+
```
54+
55+
### Building image
56+
57+
Clone the azure-powershell repo, and in your local copy run the following commands:
58+
59+
```sh
60+
$ dotnet msbuild /t:Build /p:Configuration=Release
61+
$ dotnet msbuild /t:publish /p:Configuration=Release /p:NuGetKey=1234
62+
$ dotnet msbuild /t:BuildImage /p:DockerImageName=mcr.microsoft.com/azure-powershell
63+
$ docker images
64+
```
65+
66+
### Remove image
67+
68+
```sh
69+
docker rmi mcr.microsoft.com/azure-powershell
70+
```
71+
72+
## Developing and Contributing
73+
74+
Please see the [Contribution Guide][] for general information about how to develop and contribute.
75+
76+
If you have any problems, please consult the [GitHub issues][].
77+
If you do not see your problem captured, please file a [new issue][] and follow the provided template.
78+
79+
[Contribution Guide]: https://github.com/Azure/azure-powershell/blob/master/CONTRIBUTING.md
80+
[GitHub issues]: https://github.com/Azure/azure-powershell/issues
81+
[new issue]:https://aka.ms/azpsissue
82+
83+
84+
## Legal and Licensing
85+
86+
Azure-PowerShell is licensed under the [Apache license][].
87+
88+
[Apache license]: https://github.com/Azure/azure-powershell/blob/master/LICENSE.txt
89+
90+
91+
PowerShell is licensed under the [Apache license][].
92+
93+
[Apache license]: https://github.com/PowerShell/PowerShell/tree/master/LICENSE.txt
94+
95+
## [Code of Conduct][conduct-md]
96+
97+
This project has adopted the [Microsoft Open Source Code of Conduct][conduct-code].
98+
For more information see the [Code of Conduct FAQ][conduct-FAQ] or contact [[email protected]][conduct-email] with any additional questions or comments.
99+
100+
[conduct-code]: http://opensource.microsoft.com/codeofconduct/
101+
[conduct-FAQ]: http://opensource.microsoft.com/codeofconduct/faq/
102+
[conduct-email]: mailto:[email protected]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Mode":"CurrentUser","ContextDirectory":"/root/.Azure","ContextFile":"AzureRmContext.json","CacheDirectory":"/root/.Azure","CacheFile":"TokenCache.dat","Settings":{}}

src/Blueprint/Blueprint/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Show DependsOn property value in the table view
22+
* Add support to accept PolicyDefinitionParameter empty
2123

2224
## Version 0.2.10
2325
* Added support to include subfolders when deploying blueprints with artifacts

src/Blueprint/Blueprint/Cmdlets/BlueprintArtifacts/NewAzureRMBlueprintArtifact.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public class NewAzureRMBlueprintArtifact : BlueprintArtifactsCmdletBase
6868
public string PolicyDefinitionId { get; set; }
6969

7070
[Parameter(ParameterSetName = ParameterSetNames.CreatePolicyAssignmentArtifact, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.ArtifactPolicyDefinitionParameter)]
71-
[ValidateNotNullOrEmpty]
7271
public Hashtable PolicyDefinitionParameter { get; set; }
7372

7473
[Parameter(ParameterSetName = ParameterSetNames.CreateTemplateArtifact, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.ArtifactTemplateParameterFile)]

src/Blueprint/Blueprint/Cmdlets/BlueprintArtifacts/SetAzureRMBlueprintArtifact.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public class SetAzureRmBlueprintArtifact : BlueprintArtifactsCmdletBase
6969
public string PolicyDefinitionId { get; set; }
7070

7171
[Parameter(ParameterSetName = ParameterSetNames.UpdatePolicyAssignmentArtifact, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.ArtifactPolicyDefinitionParameter)]
72-
[ValidateNotNullOrEmpty]
7372
public Hashtable PolicyDefinitionParameter { get; set; }
7473

7574
[Parameter(ParameterSetName = ParameterSetNames.UpdateTemplateArtifact, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = ParameterHelpMessages.ArtifactTemplateParameterFile)]

src/Blueprint/Blueprint/Models/PSPolicyAssignmentArtifact.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ internal static PSPolicyAssignmentArtifact FromArtifactModel(PolicyAssignmentArt
4848
psArtifact.Parameters.Add(item.Key, parameter);
4949
}
5050

51-
psArtifact.DependsOn = artifact.DependsOn.Select(x => x) as List<string>;
51+
psArtifact.DependsOn = artifact.DependsOn?.ToList();
5252

5353
return psArtifact;
5454
}

src/Blueprint/Blueprint/Models/PSRoleAssignmentArtifact.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ internal static PSRoleAssignmentArtifact FromArtifactModel(RoleAssignmentArtifac
4242
ResourceGroup = artifact.ResourceGroup
4343
};
4444

45-
psArtifact.DependsOn = artifact.DependsOn.Select(x => x) as List<string>;
45+
psArtifact.DependsOn = artifact.DependsOn?.ToList();
4646

4747
return psArtifact;
4848
}

src/Blueprint/Blueprint/Models/PSTemplateArtifact.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ internal static PSTemplateArtifact FromArtifactModel(TemplateArtifact artifact,
4848
psArtifact.Parameters.Add(item.Key, parameter);
4949
}
5050

51-
psArtifact.DependsOn = artifact.DependsOn.Select(x => x) as List<string>;
51+
psArtifact.DependsOn = artifact.DependsOn?.ToList();
5252

5353
return psArtifact;
5454
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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.ServiceManagement.Common.Models;
16+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
17+
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
18+
using Xunit;
19+
using Xunit.Abstractions;
20+
21+
namespace Microsoft.Azure.Commands.IotHub.Test.ScenarioTests
22+
{
23+
public class IotHubDPModuleTests : RMTestBase
24+
{
25+
public XunitTracingInterceptor _logger;
26+
27+
public IotHubDPModuleTests(ITestOutputHelper output)
28+
{
29+
_logger = new XunitTracingInterceptor(output);
30+
XunitTracingInterceptor.AddToContext(_logger);
31+
}
32+
33+
[Fact]
34+
[Trait(Category.AcceptanceType, Category.LiveOnly)]
35+
public void TestAzureIotHubModuleLifecycle()
36+
{
37+
IotHubController.NewInstance.RunPsTest(_logger, "Test-AzureRmIotHubModuleLifecycle");
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)