Commits (4)
FROM ubuntu:16.04
RUN apt-get update && \
apt-get install -y curl sudo apt-transport-https
# Import the public repository GPG keys
RUN curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - && \
# Register the Microsoft Ubuntu repository
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list && \
# Update the list of products
apt-get update && \
# Install PowerShell
apt-get install -y powershell
#Powershell azure installation
RUN pwsh -c 'Install-Module -Confirm -AllowClobber -SkipPublisherCheck AzureRM.NetCore'
RUN pwsh -c 'Install-Module -Confirm AzureRM.NetCore'
# Create shared dir
RUN mkdir /code
this is test content
# Prepare env
Install-Module AzureRM.NetCore
Import-Module AzureRM.NetCore
$location="West Europe"
$whitelist = @("", "", "")
# Create a resource group.
New-AzureRmResourceGroup -Name myResourceGroup -Location $location
# Create the public and private subnets.
$Subnet1 = New-AzureRmVirtualNetworkSubnetConfig -Name Public -AddressPrefix
# Create a virtual network.
New-AzureRmVirtualNetwork -ResourceGroupName myResourceGroup -Location $location -Name myVnet -AddressPrefix -Subnet $Subnet1
$nsg = New-AzureRmNetworkSecurityGroup -ResourceGroupName myResourceGroup -Location $location -Name "NSG-WebApp"
$Vnet = Get-AzureRmVirtualNetwork -ResourceGroupName myResourceGroup -Name myVnet
Set-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $Vnet -Name Public -AddressPrefix -NetworkSecurityGroup $nsg
Set-AzureRmVirtualNetwork -VirtualNetwork $Vnet
$prio = 100
foreach ($ip in $whitelist) {
Get-AzureRmNetworkSecurityGroup -Name NSG-WebApp -ResourceGroupName myResourceGroup | Add-AzureRmNetworkSecurityRuleConfig -Name "rule$(Get-Random)" -Description "Whitelist IP" `
-Access Allow -Protocol Tcp -Direction Inbound -Priority $prio -SourceAddressPrefix $ip -SourcePortRange * -DestinationAddressPrefix * -DestinationPortRange * | Set-AzureRmNetworkSecurityGroup
# Create an App Service plan in `Free` tier.
New-AzureRmAppServicePlan -Name $webappname -Location $location -ResourceGroupName myResourceGroup -Tier Free
# Create a web app.
New-AzureRmWebApp -Name $webappname -Location $location -AppServicePlan $webappname -ResourceGroupName myResourceGroup
# Configure GitHub deployment from your GitHub repo and deploy once.
$PropertiesObject = @{
scmType = "LocalGit";
Set-AzureRmResource -PropertyObject $PropertiesObject -ResourceGroupName myResourceGroup -ResourceType Microsoft.Web/sites/config -ResourceName $webappname/web -ApiVersion 2015-08-01 -Force
# Get app-level deployment credentials
$xml = [xml](Get-AzureRmWebAppPublishingProfile -Name $webappname -ResourceGroupName myResourceGroup -OutputFile null)
$username = $xml.SelectNodes("//publishProfile[@publishMethod=`"MSDeploy`"]/@userName").value
$password = $xml.SelectNodes("//publishProfile[@publishMethod=`"MSDeploy`"]/@userPWD").value
Write-Host "$username [-] $password"
#.NET Core Install
brew update
brew install openssl
mkdir -p /usr/local/lib
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
brew install wget
wget https://download.microsoft.com/download/1/4/1/141760B3-805B-4583-B17C-8C5BC5A876AB/Installers/dotnet-dev-osx-x64.1.0.0-preview2-1-003177.pkg
sudo installer -pkg dotnet-dev-osx-x64.1.0.0-preview2-1-003177.pkg -target /
#PowerShell Core 6.14
wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.14/powershell-6.0.0-alpha.14.pkg
sudo installer -pkg powershell-6.0.0-alpha.14.pkg -target /
#Azure RM NetCore Preview Module Install
powershell Install-Module AzureRM.NetCore.Preview
powershell Import-Module AzureRM.NetCore.Preview
if [[ $? -eq 0 ]]
echo "Successfully installed PowerShell Core with AzureRM NetCore Preview Module."
echo "PowerShell Core with AzureRM NetCore Preview Module did not install successfully." >&2
#Install Azure CLI
#Address https://azure.microsoft.com/en-us/documentation/articles/xplat-cli-install/
read -p "Do you want to install Azure CLI? y/n" -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
brew install npm
brew install node.js
sudo npm install -g azure-cli
# sudo ln -s /usr/bin/nodejs /usr/bin/node
if [[ $? -eq 0 ]]
echo "Successfully installed Azure CLI"
echo "Azure CLI not installed successfully." >&2
echo "You chose not to install Azure CLI. Exiting now."
#non brew install
# wget http://aka.ms/mac-azure-cli
# sudo hdiutil attach azure-cli.0.10.5.dmg
# sudo installer -pkg /Volumes/azure-cli.0.10.5/azure-cli.0.10.5.dmg -target /
## Install powershell
# Download the powershell '.tar.gz' archive
curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-rc/powershell-6.0.0-rc-osx-x64.tar.gz
# Create the target folder where powershell will be placed
sudo mkdir -p /usr/local/microsoft/powershell/6.0.0-rc
# Expand powershell to the target folder
sudo tar zxf /tmp/powershell.tar.gz -C /usr/local/microsoft/powershell/6.0.0-rc
# Set execute permissions
sudo chmod +x /usr/local/microsoft/powershell/6.0.0-rc/pwsh
# Create the symbolic link that points to pwsh
sudo ln -s /usr/local/microsoft/powershell/6.0.0-rc/pwsh /usr/local/bin/pwsh
# Show version of PowerShellGet
pwsh -c 'Get-Module PowerShellGet -list | Select-Object Name,Version,Path'
# Install azure module for powershell
sudo pwsh -c 'Install-Module AzureRM -AllowClobber'
# Verify that the module has been installed correctly
pwsh -c 'Get-Module AzureRM -list | Select-Object Name,Version,Path'