Skip to content

Commit 39a3de6

Browse files
author
Ewan Noble
authored
Merge pull request #85 from SkillsFundingAgency/DASD-3739
ContainerPermission parameter added
2 parents 3642e97 + fb4d082 commit 39a3de6

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"powershell.codeFormatting.newLineAfterCloseBrace": true,
55
"powershell.codeFormatting.whitespaceBeforeOpenBrace": true,
66
"powershell.codeFormatting.whitespaceBeforeOpenParen": true,
7-
"powershell.codeFormatting.whitespaceAroundOperator": false,
7+
"powershell.codeFormatting.whitespaceAroundOperator": true,
88
"powershell.codeFormatting.whitespaceAfterSeparator": true,
99
"powershell.codeFormatting.ignoreOneLineBlock": false,
1010
"powershell.codeFormatting.preset": "Custom",

Infrastructure/Resources/New-StorageAccountContainer.ps1

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@ The name of the Storage Account
1515
.PARAMETER ContainerName
1616
The names of one or more Containers to create in the Storage Account
1717
18+
.PARAMETER ContainerPermission
19+
The permission on the Container(s). The acceptable values are 'Container', 'Blob' or 'Off'
20+
1821
.EXAMPLE
19-
.\New-StorageAccountContainer.ps1 -Location "West Europe" -Name stracc -ContainerName public
22+
.\New-StorageAccountContainer.ps1 -Location "West Europe" -Name stracc -ContainerName public -ContainerPermission "Blob"
2023
2124
.EXAMPLE
22-
.\New-StorageAccountContainer.ps1 -Location "West Europe" -Name stracc -ContainerName public,private,images
25+
.\New-StorageAccountContainer.ps1 -Location "West Europe" -Name stracc -ContainerName public,private,images -ContainerPermission "Blob"
2326
2427
#>
2528

@@ -30,7 +33,11 @@ Param(
3033
[Parameter(Mandatory = $true)]
3134
[String]$Name,
3235
[Parameter(Mandatory = $true)]
33-
[String[]]$ContainerName
36+
[String[]]$ContainerName,
37+
[Parameter(Mandatory = $false)]
38+
[ValidateSet("Container", "Blob", "Off")]
39+
[String]$ContainerPermission = "Off"
40+
3441
)
3542

3643
try {
@@ -62,7 +69,7 @@ try {
6269
if (!$ContainerExists) {
6370
try {
6471
Write-Log -LogLevel Information -Message "Creating container $Container"
65-
$null = New-AzureStorageContainer -Context $StorageAccountContext -Name $Container -Permission Off
72+
$null = New-AzureStorageContainer -Context $StorageAccountContext -Name $Container -Permission $ContainerPermission
6673
}
6774
catch {
6875
throw "Could not create container $Container : $_"

0 commit comments

Comments
 (0)