Doc updated
This commit is contained in:
parent
fb72a0efc6
commit
09b0e3ee48
@ -1,22 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio 15
|
|
||||||
VisualStudioVersion = 15.0.26430.6
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{151D2E53-A2C4-4D7D-83FE-D05416EBD58E}") = "eShopOnAzure.Deploy", "eShopOnAzure.Deploy\eShopOnAzure.Deploy.deployproj", "{642B3F2E-3011-4B1A-8D22-D35C11C44F05}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{642B3F2E-3011-4B1A-8D22-D35C11C44F05}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{642B3F2E-3011-4B1A-8D22-D35C11C44F05}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{642B3F2E-3011-4B1A-8D22-D35C11C44F05}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{642B3F2E-3011-4B1A-8D22-D35C11C44F05}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
@ -1,120 +0,0 @@
|
|||||||
#Requires -Version 3.0
|
|
||||||
#Requires -Module AzureRM.Resources
|
|
||||||
#Requires -Module Azure.Storage
|
|
||||||
|
|
||||||
Param(
|
|
||||||
[string] [Parameter(Mandatory=$true)] $ResourceGroupLocation,
|
|
||||||
[string] $ResourceGroupName = 'eShopOnAzure.Deploy',
|
|
||||||
[switch] $UploadArtifacts,
|
|
||||||
[string] $StorageAccountName,
|
|
||||||
[string] $StorageContainerName = $ResourceGroupName.ToLowerInvariant() + '-stageartifacts',
|
|
||||||
[string] $TemplateFile = 'azuredeploy.json',
|
|
||||||
[string] $TemplateParametersFile = 'azuredeploy.parameters.json',
|
|
||||||
[string] $ArtifactStagingDirectory = '.',
|
|
||||||
[string] $DSCSourceFolder = 'DSC',
|
|
||||||
[switch] $ValidateOnly
|
|
||||||
)
|
|
||||||
|
|
||||||
try {
|
|
||||||
[Microsoft.Azure.Common.Authentication.AzureSession]::ClientFactory.AddUserAgent("VSAzureTools-$UI$($host.name)".replace(' ','_'), '3.0.0')
|
|
||||||
} catch { }
|
|
||||||
|
|
||||||
$ErrorActionPreference = 'Stop'
|
|
||||||
Set-StrictMode -Version 3
|
|
||||||
|
|
||||||
function Format-ValidationOutput {
|
|
||||||
param ($ValidationOutput, [int] $Depth = 0)
|
|
||||||
Set-StrictMode -Off
|
|
||||||
return @($ValidationOutput | Where-Object { $_ -ne $null } | ForEach-Object { @(' ' * $Depth + ': ' + $_.Message) + @(Format-ValidationOutput @($_.Details) ($Depth + 1)) })
|
|
||||||
}
|
|
||||||
|
|
||||||
$OptionalParameters = New-Object -TypeName Hashtable
|
|
||||||
$TemplateFile = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, $TemplateFile))
|
|
||||||
$TemplateParametersFile = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, $TemplateParametersFile))
|
|
||||||
|
|
||||||
if ($UploadArtifacts) {
|
|
||||||
# Convert relative paths to absolute paths if needed
|
|
||||||
$ArtifactStagingDirectory = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, $ArtifactStagingDirectory))
|
|
||||||
$DSCSourceFolder = [System.IO.Path]::GetFullPath([System.IO.Path]::Combine($PSScriptRoot, $DSCSourceFolder))
|
|
||||||
|
|
||||||
# Parse the parameter file and update the values of artifacts location and artifacts location SAS token if they are present
|
|
||||||
$JsonParameters = Get-Content $TemplateParametersFile -Raw | ConvertFrom-Json
|
|
||||||
if (($JsonParameters | Get-Member -Type NoteProperty 'parameters') -ne $null) {
|
|
||||||
$JsonParameters = $JsonParameters.parameters
|
|
||||||
}
|
|
||||||
$ArtifactsLocationName = '_artifactsLocation'
|
|
||||||
$ArtifactsLocationSasTokenName = '_artifactsLocationSasToken'
|
|
||||||
$OptionalParameters[$ArtifactsLocationName] = $JsonParameters | Select -Expand $ArtifactsLocationName -ErrorAction Ignore | Select -Expand 'value' -ErrorAction Ignore
|
|
||||||
$OptionalParameters[$ArtifactsLocationSasTokenName] = $JsonParameters | Select -Expand $ArtifactsLocationSasTokenName -ErrorAction Ignore | Select -Expand 'value' -ErrorAction Ignore
|
|
||||||
|
|
||||||
# Create DSC configuration archive
|
|
||||||
if (Test-Path $DSCSourceFolder) {
|
|
||||||
$DSCSourceFilePaths = @(Get-ChildItem $DSCSourceFolder -File -Filter '*.ps1' | ForEach-Object -Process {$_.FullName})
|
|
||||||
foreach ($DSCSourceFilePath in $DSCSourceFilePaths) {
|
|
||||||
$DSCArchiveFilePath = $DSCSourceFilePath.Substring(0, $DSCSourceFilePath.Length - 4) + '.zip'
|
|
||||||
Publish-AzureRmVMDscConfiguration $DSCSourceFilePath -OutputArchivePath $DSCArchiveFilePath -Force -Verbose
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create a storage account name if none was provided
|
|
||||||
if ($StorageAccountName -eq '') {
|
|
||||||
$StorageAccountName = 'stage' + ((Get-AzureRmContext).Subscription.SubscriptionId).Replace('-', '').substring(0, 19)
|
|
||||||
}
|
|
||||||
|
|
||||||
$StorageAccount = (Get-AzureRmStorageAccount | Where-Object{$_.StorageAccountName -eq $StorageAccountName})
|
|
||||||
|
|
||||||
# Create the storage account if it doesn't already exist
|
|
||||||
if ($StorageAccount -eq $null) {
|
|
||||||
$StorageResourceGroupName = 'ARM_Deploy_Staging'
|
|
||||||
New-AzureRmResourceGroup -Location "$ResourceGroupLocation" -Name $StorageResourceGroupName -Force
|
|
||||||
$StorageAccount = New-AzureRmStorageAccount -StorageAccountName $StorageAccountName -Type 'Standard_LRS' -ResourceGroupName $StorageResourceGroupName -Location "$ResourceGroupLocation"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Generate the value for artifacts location if it is not provided in the parameter file
|
|
||||||
if ($OptionalParameters[$ArtifactsLocationName] -eq $null) {
|
|
||||||
$OptionalParameters[$ArtifactsLocationName] = $StorageAccount.Context.BlobEndPoint + $StorageContainerName
|
|
||||||
}
|
|
||||||
|
|
||||||
# Copy files from the local storage staging location to the storage account container
|
|
||||||
New-AzureStorageContainer -Name $StorageContainerName -Context $StorageAccount.Context -ErrorAction SilentlyContinue *>&1
|
|
||||||
|
|
||||||
$ArtifactFilePaths = Get-ChildItem $ArtifactStagingDirectory -Recurse -File | ForEach-Object -Process {$_.FullName}
|
|
||||||
foreach ($SourcePath in $ArtifactFilePaths) {
|
|
||||||
Set-AzureStorageBlobContent -File $SourcePath -Blob $SourcePath.Substring($ArtifactStagingDirectory.length + 1) `
|
|
||||||
-Container $StorageContainerName -Context $StorageAccount.Context -Force
|
|
||||||
}
|
|
||||||
|
|
||||||
# Generate a 4 hour SAS token for the artifacts location if one was not provided in the parameters file
|
|
||||||
if ($OptionalParameters[$ArtifactsLocationSasTokenName] -eq $null) {
|
|
||||||
$OptionalParameters[$ArtifactsLocationSasTokenName] = ConvertTo-SecureString -AsPlainText -Force `
|
|
||||||
(New-AzureStorageContainerSASToken -Container $StorageContainerName -Context $StorageAccount.Context -Permission r -ExpiryTime (Get-Date).AddHours(4))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Create or update the resource group using the specified template file and template parameters file
|
|
||||||
New-AzureRmResourceGroup -Name $ResourceGroupName -Location $ResourceGroupLocation -Verbose -Force
|
|
||||||
|
|
||||||
if ($ValidateOnly) {
|
|
||||||
$ErrorMessages = Format-ValidationOutput (Test-AzureRmResourceGroupDeployment -ResourceGroupName $ResourceGroupName `
|
|
||||||
-TemplateFile $TemplateFile `
|
|
||||||
-TemplateParameterFile $TemplateParametersFile `
|
|
||||||
@OptionalParameters)
|
|
||||||
if ($ErrorMessages) {
|
|
||||||
Write-Output '', 'Validation returned the following errors:', @($ErrorMessages), '', 'Template is invalid.'
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Output '', 'Template is valid.'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
New-AzureRmResourceGroupDeployment -Name ((Get-ChildItem $TemplateFile).BaseName + '-' + ((Get-Date).ToUniversalTime()).ToString('MMdd-HHmm')) `
|
|
||||||
-ResourceGroupName $ResourceGroupName `
|
|
||||||
-TemplateFile $TemplateFile `
|
|
||||||
-TemplateParameterFile $TemplateParametersFile `
|
|
||||||
@OptionalParameters `
|
|
||||||
-Force -Verbose `
|
|
||||||
-ErrorVariable ErrorMessages
|
|
||||||
if ($ErrorMessages) {
|
|
||||||
Write-Output '', 'Template deployment returned the following errors:', @(@($ErrorMessages) | ForEach-Object { $_.Exception.Message.TrimEnd("`r`n") })
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,123 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
|
||||||
<DebugSymbols>false</DebugSymbols>
|
|
||||||
<SkipCopyBuildProduct>true</SkipCopyBuildProduct>
|
|
||||||
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
|
|
||||||
<TargetRuntime>None</TargetRuntime>
|
|
||||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">obj\</BaseIntermediateOutputPath>
|
|
||||||
<BaseIntermediateOutputPath Condition=" !HasTrailingSlash('$(BaseIntermediateOutputPath)') ">$(BaseIntermediateOutputPath)\</BaseIntermediateOutputPath>
|
|
||||||
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
|
|
||||||
<ProjectReferencesOutputPath Condition=" '$(ProjectReferencesOutputPath)' == '' ">$(IntermediateOutputPath)ProjectReferences</ProjectReferencesOutputPath>
|
|
||||||
<ProjectReferencesOutputPath Condition=" !HasTrailingSlash('$(ProjectReferencesOutputPath)') ">$(ProjectReferencesOutputPath)\</ProjectReferencesOutputPath>
|
|
||||||
<StageArtifacts Condition=" '$(StageArtifacts)' == '' ">true</StageArtifacts>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<DefineCommonItemSchemas>false</DefineCommonItemSchemas>
|
|
||||||
<DefineCommonCapabilities>false</DefineCommonCapabilities>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ProjectExtensions>
|
|
||||||
<ProjectCapabilities>
|
|
||||||
<DeploymentProject />
|
|
||||||
</ProjectCapabilities>
|
|
||||||
</ProjectExtensions>
|
|
||||||
|
|
||||||
<ItemDefinitionGroup>
|
|
||||||
<Content>
|
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<None>
|
|
||||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<ProjectReference>
|
|
||||||
<Private>false</Private>
|
|
||||||
<Targets>Build</Targets>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
|
|
||||||
<Target Name="CreateManifestResourceNames" />
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<StageArtifactsDependsOn>
|
|
||||||
_GetDeploymentProjectContent;
|
|
||||||
_CalculateContentOutputRelativePaths;
|
|
||||||
_GetReferencedProjectsOutput;
|
|
||||||
_CalculateArtifactStagingDirectory;
|
|
||||||
_CopyOutputToArtifactStagingDirectory;
|
|
||||||
</StageArtifactsDependsOn>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<Target Name="_CopyOutputToArtifactStagingDirectory">
|
|
||||||
<Copy SourceFiles="@(DeploymentProjectContentOutput)" DestinationFiles="$(ArtifactStagingDirectory)\$(MSBuildProjectName)%(RelativePath)" />
|
|
||||||
<Copy SourceFiles="@(BuildProjectReferencesOutput)" DestinationFiles="$(ArtifactStagingDirectory)\$(MSBuildProjectName)\%(ProjectName)\%(RecursiveDir)%(FileName)%(Extension)" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<Target Name="_GetDeploymentProjectContent">
|
|
||||||
<MSBuild Projects="$(MSBuildProjectFile)" Targets="ContentFilesProjectOutputGroup">
|
|
||||||
<Output TaskParameter="TargetOutputs" ItemName="DeploymentProjectContentOutput" />
|
|
||||||
</MSBuild>
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<Target Name="_GetReferencedProjectsOutput">
|
|
||||||
<PropertyGroup>
|
|
||||||
<MsBuildProperties>Configuration=$(Configuration);Platform=$(Platform)</MsBuildProperties>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<MSBuild Projects="@(ProjectReference)"
|
|
||||||
BuildInParallel="$(BuildInParallel)"
|
|
||||||
Properties="$(MsBuildProperties)"
|
|
||||||
Targets="%(ProjectReference.Targets)" />
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<BuildProjectReferencesOutput Include="%(ProjectReference.IncludeFilePath)">
|
|
||||||
<ProjectName>$([System.IO.Path]::GetFileNameWithoutExtension('%(ProjectReference.Identity)'))</ProjectName>
|
|
||||||
</BuildProjectReferencesOutput>
|
|
||||||
</ItemGroup>
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<Target Name="_CalculateArtifactStagingDirectory" Condition=" '$(ArtifactStagingDirectory)'=='' ">
|
|
||||||
<PropertyGroup>
|
|
||||||
<ArtifactStagingDirectory Condition=" '$(OutDir)'!='' ">$(OutDir)</ArtifactStagingDirectory>
|
|
||||||
<ArtifactStagingDirectory Condition=" '$(ArtifactStagingDirectory)'=='' ">$(OutputPath)</ArtifactStagingDirectory>
|
|
||||||
<ArtifactStagingDirectory Condition=" !HasTrailingSlash('$(ArtifactStagingDirectory)') ">$(ArtifactStagingDirectory)\</ArtifactStagingDirectory>
|
|
||||||
<ArtifactStagingDirectory>$(ArtifactStagingDirectory)staging\</ArtifactStagingDirectory>
|
|
||||||
<ArtifactStagingDirectory Condition=" '$(Build_StagingDirectory)'!='' AND '$(TF_Build)'=='True' ">$(Build_StagingDirectory)</ArtifactStagingDirectory>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<!-- Appends each of the deployment project's content output files with metadata indicating its relative path from the deployment project's folder. -->
|
|
||||||
<Target Name="_CalculateContentOutputRelativePaths"
|
|
||||||
Outputs="%(DeploymentProjectContentOutput.Identity)">
|
|
||||||
<PropertyGroup>
|
|
||||||
<_OriginalIdentity>%(DeploymentProjectContentOutput.Identity)</_OriginalIdentity>
|
|
||||||
<_RelativePath>$(_OriginalIdentity.Replace('$(MSBuildProjectDirectory)', ''))</_RelativePath>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<DeploymentProjectContentOutput>
|
|
||||||
<RelativePath>$(_RelativePath)</RelativePath>
|
|
||||||
</DeploymentProjectContentOutput>
|
|
||||||
</ItemGroup>
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
<Target Name="CoreCompile" />
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<StageArtifactsAfterTargets Condition=" '$(StageArtifacts)' == 'true' ">
|
|
||||||
PrepareForRun
|
|
||||||
</StageArtifactsAfterTargets>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<Target Name="StageArtifacts" DependsOnTargets="$(StageArtifactsDependsOn)" AfterTargets="$(StageArtifactsAfterTargets)"/>
|
|
||||||
|
|
||||||
<!-- Custom target to clean up local deployment staging files -->
|
|
||||||
<Target Name="DeleteBinObjFolders" BeforeTargets="Clean">
|
|
||||||
<RemoveDir Directories="$(OutputPath)" />
|
|
||||||
<RemoveDir Directories="$(BaseIntermediateOutputPath)" />
|
|
||||||
</Target>
|
|
||||||
</Project>
|
|
@ -1,38 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
|
||||||
<ProjectConfiguration Include="Debug|AnyCPU">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>AnyCPU</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|AnyCPU">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>AnyCPU</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectGuid>642b3f2e-3011-4b1a-8d22-d35c11c44f05</ProjectGuid>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFrameworkIdentifier>Deployment</TargetFrameworkIdentifier>
|
|
||||||
<TargetFrameworkVersion>1.0</TargetFrameworkVersion>
|
|
||||||
<PrepareForBuildDependsOn>
|
|
||||||
</PrepareForBuildDependsOn>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Condition=" Exists('Deployment.targets') " Project="Deployment.targets" />
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
|
|
||||||
<!-- vertag<:>start tokens<:>maj.min -->
|
|
||||||
<Import Condition=" Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Deployment\1.1\DeploymentProject.targets') " Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Deployment\1.1\DeploymentProject.targets" />
|
|
||||||
<!-- vertag<:>end -->
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Deployment.targets">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
</None>
|
|
||||||
<Content Include="Deploy-AzureResourceGroup.ps1" />
|
|
||||||
<Content Include="sqldeploy.json">
|
|
||||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="sqldeploy.parameters.json" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Target Name="GetReferenceAssemblyPaths" />
|
|
||||||
</Project>
|
|
23
deploy/az/create-resources.cmd
Normal file
23
deploy/az/create-resources.cmd
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
@echo off
|
||||||
|
if %1.==. GOTO error
|
||||||
|
if %2.==. GOTO error
|
||||||
|
if NOT %3.==-c. GOTO deployresources
|
||||||
|
if %4.==. GOTO error
|
||||||
|
echo Creating resource group %2 in '%4'
|
||||||
|
call az group create --name %2 --location %4
|
||||||
|
:deployresources
|
||||||
|
echo Deploying ARM template '%1.json' in resource group %2
|
||||||
|
call az group deployment create --resource-group %2 --parameters @%1.parameters.json --template-file %1.json
|
||||||
|
GOTO end
|
||||||
|
:error
|
||||||
|
echo.
|
||||||
|
echo Usage:
|
||||||
|
echo create-resources arm-file resource-group-name [-c location]
|
||||||
|
echo arm-file: Path to ARM template WITHOUT .json extension. An parameter file with same name plus '.parameters' MUST exist in same folde
|
||||||
|
echo resource-grop-name: Name of the resource group to use or create
|
||||||
|
echo -c: If appears means that resource group must be created. If -c is specified, must use enter location
|
||||||
|
echo.
|
||||||
|
echo Examples:
|
||||||
|
echo create-resources path_and_filename testgroup (Deploys path_and_filename.json with parameters specified in path_and_filename.parameters.json file).
|
||||||
|
echo create-resources path_and_filename newgroup -c westus (Deploys path_and_filename.json (with parameters specified in path_and_filename.parameters.json file) in a NEW resource group named newgroup in the westus location)
|
||||||
|
:end
|
20
deploy/az/readme.md
Normal file
20
deploy/az/readme.md
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Deploying resources using create-resources script
|
||||||
|
|
||||||
|
The `create-resources` script is a basic script to allow easy deployment of one ARM template in one resource group. You can deploy to an existing resource group or to create one.
|
||||||
|
|
||||||
|
## Deploying to a existing resource group
|
||||||
|
|
||||||
|
Just type `create-resources path-to-arm-template resourcegroup`. Called this way the script will:
|
||||||
|
|
||||||
|
1. Search for `path-to-arm-template.json` and `path-to-arm-template.parameters.json` files
|
||||||
|
2. If they exist, will deploy them in the `resourcegroup` specified (that has to exist).
|
||||||
|
|
||||||
|
## Deploying to a new resource group
|
||||||
|
|
||||||
|
Just type `create-resources path-to-arm-template resourcegroup -c location`. Called this way the script will:
|
||||||
|
|
||||||
|
1. Search for `path-to-arm-template.json` and `path-to-arm-template.parameters.json` files
|
||||||
|
2. If they exist, will create the `resourcegroup` specified in the `location` specified.
|
||||||
|
3. Finally will deploy `path-to-arm-template.json` and `path-to-arm-template.parameters.json` files in the `resourcegroup`
|
||||||
|
|
||||||
|
|
33
deploy/az/sql/readme.md
Normal file
33
deploy/az/sql/readme.md
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# Deploying SQL Server & SQL Databases
|
||||||
|
|
||||||
|
The ARM template `sqldeploy.json` and its parameter file (`sqldeploy.parameters.json`) are used to deploy following resources:
|
||||||
|
|
||||||
|
1. One SQL Server
|
||||||
|
2. Three SQL databases (for ordering, catalog and identity) services.
|
||||||
|
3. Firewall rules to **allow access from any IP to SQL Server**. This allows easy management, but is not desired in production environments.
|
||||||
|
|
||||||
|
## Editing sqldeploy.parameters.json file
|
||||||
|
|
||||||
|
You have to edit the `sqldeploy.parameters.json` file to set your values. There are two parameters:
|
||||||
|
|
||||||
|
1. `sql_server` is a object parameter that contains the sql server name, the admin login and password, and the database names.
|
||||||
|
2. `suffix` is a suffix that will be added to thee sql_server name to ensure uniqueness.
|
||||||
|
|
||||||
|
## Deploy the template
|
||||||
|
|
||||||
|
Once parameter file is edited you can deploy it using [create-resources script](../readme.md).
|
||||||
|
|
||||||
|
i. e. if you are in windows, to deploy sql databases in a new resourcegroup located in westus, go to `deploy\az` folder and type:
|
||||||
|
|
||||||
|
```
|
||||||
|
create-resources.cmd sql\sqldeploy newResourceGroup -c westus
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
|||||||
@echo off
|
|
||||||
if %1.==. GOTO error
|
|
||||||
if NOT %2.==-c. GOTO createvm
|
|
||||||
if %3.==. GOTO error
|
|
||||||
echo Creating resource group %1 in '%3'
|
|
||||||
call az group create --name %1 --location %3
|
|
||||||
:createvm
|
|
||||||
echo Creating VM in resource group %1
|
|
||||||
call az group deployment create --resource-group %1 --parameters @mvparams.json --template-file azuredeploy.json
|
|
||||||
GOTO end
|
|
||||||
:error
|
|
||||||
echo.
|
|
||||||
echo Usage:
|
|
||||||
echo create-resources resource-group-name [-c location]
|
|
||||||
echo resource-grop-name: Name of the resource group to use or create
|
|
||||||
echo -c: If appears means that resource group must be created. If -c is specified, must use enter location
|
|
||||||
echo.
|
|
||||||
echo Examples:
|
|
||||||
echo create-resources testgroup (Creates VM in a existing testgroup resource group)
|
|
||||||
echo create-resources newgroup -c westus (Creates the VM in a NEW resource group named newgroup in the westus location)
|
|
||||||
:end
|
|
@ -13,15 +13,21 @@ Ensure you are logged in the desired subscription (use `az login` and `az accoun
|
|||||||
|
|
||||||
Go to `linux-vm` or `win-vm` folder (based on if you want a Linux or Windows VM). Then:
|
Go to `linux-vm` or `win-vm` folder (based on if you want a Linux or Windows VM). Then:
|
||||||
|
|
||||||
1. Edit the file `mvparams.json` with your desired values
|
1. Edit the file `linuxvm.parameters.json` or `windowsvm.parameters.json` (based on what VM do you want to create) with your desired values
|
||||||
2. Run the file `create-resources.cmd` from command-line to create the VM.
|
2. Run the [create-resources script](../readme.md) to deploy the desired template (`linux-vm/linuxvm.json` or `win-vm/windowsvm.json`).
|
||||||
|
|
||||||
**Note:** To avoid errors, ARM template used (`azuredeploy.json`), generates unique names for:
|
I. e. if you are in Windows and want to deploy a linux based VM, in a new resourcegroup located in westus, go to `deploy\az` folder and type:
|
||||||
|
|
||||||
|
```
|
||||||
|
create-resources.cmd vms\linux-vm\linuxvm newResourceGroup -c westus
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:** To avoid errors, ARM template used generates unique names for:
|
||||||
|
|
||||||
1. VM used storage
|
1. VM used storage
|
||||||
2. Public DNS
|
2. Public DNS
|
||||||
|
|
||||||
Those public names are based on the parameters set in `mvparams.json` file.
|
Those public names are based on the parameters set in the parameters file.
|
||||||
|
|
||||||
### The mvparams.json file
|
### The mvparams.json file
|
||||||
|
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
if %1.==. GOTO error
|
|
||||||
if %2.!=-c. GOTO createvm
|
|
||||||
if %3.==. GOTO error
|
|
||||||
az group create --name %1 --location %3
|
|
||||||
createvm:
|
|
||||||
az group deployment create --resource-group %1 --parameters @mvparams.json --template-file azuredeploy.json
|
|
||||||
GOTO end
|
|
||||||
error:
|
|
||||||
@echo Usage: create-resources <resource-group-name> [-c location]
|
|
||||||
@echo <resource-grou-name>: Name of the resource group to use or create
|
|
||||||
@echo -c: If appears means that resource group must be created. If -c is specified, must use enter location
|
|
||||||
@echo Examples:
|
|
||||||
@echo create-resources testgroup (Creates VM in a existing testgroup resource group)
|
|
||||||
@echo create-resources newgroup -c westus (Creates the VM in a NEW resource group named newgroup in the westus location)
|
|
||||||
end:
|
|
@ -14,7 +14,7 @@ Login into your azure subscription by typing `az login` (note that you maybe nee
|
|||||||
|
|
||||||
## Deploying Azure resources used by the services
|
## Deploying Azure resources used by the services
|
||||||
|
|
||||||
1. [Deploying SQL Server and databases](arm/sql-server.md)
|
1. [Deploying SQL Server and databases](az/sql/readme.md)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user