Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Commit cbb9a5b

Browse files
committed
Updated ADF scripts to deploy correct storage container.
1 parent bab2811 commit cbb9a5b

2 files changed

Lines changed: 29 additions & 2 deletions

File tree

Powershell/Deploy-WTTAzureDWDatabase.ps1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,15 @@ function Deploy-WTTAzureDWDatabase
124124

125125
# Create database using 2000 units
126126
WriteLabel("Creating database '$DWDatabaseName'")
127-
$null = New-AzureRMSqlDatabase -RequestedServiceObjectiveName "DW2000" -ServerName $ServerName -DatabaseName $DWDatabaseName -Edition $DatabaseEdition -ResourceGroupName $WTTEnvironmentApplicationName -Verbose:$false
128-
WriteValue("Successful")
127+
$azureDWExist = New-AzureRMSqlDatabase -RequestedServiceObjectiveName "DW2000" -ServerName $ServerName -DatabaseName $DWDatabaseName -Edition $DatabaseEdition -ResourceGroupName $WTTEnvironmentApplicationName -Verbose:$false
128+
if(!$azureDWExist)
129+
{
130+
WriteValue("Unsuccessful")
131+
}
132+
else
133+
{
134+
WriteValue("Successful")
135+
}
129136

130137
$DWServer = (Find-AzureRmResource -ResourceType "Microsoft.Sql/servers" -ResourceNameContains "primary" -ExpandProperties).properties.FullyQualifiedDomainName
131138
# Set working location

Powershell/New-WTTADFEnvironment.ps1

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ function New-WTTADFEnvironment
8080

8181
# Get StorageAccount Key
8282
$storageAccountKey = GetStorageAccountKey
83+
CreateStorageContainer($storageAccountKey)
8384

8485
# Set up Mapping Dictionary
8586
SetupMappingDictionary($storageAccountKey)
@@ -128,6 +129,25 @@ function GetStorageAccountKey()
128129
return $storageAccountKey
129130
}
130131

132+
function CreateStorageContainer($storageAccountKey)
133+
{
134+
try{
135+
# Get Context
136+
$context = New-AzureStorageContext -storageAccountName $ApplicationName -StorageAccountKey $storageAccountKey
137+
138+
# Create the container to store blob
139+
$container = New-AzureStorageContainer -Name 'productrec' -Context $context -ErrorAction Stop
140+
}catch{
141+
if($error[0].CategoryInfo.Category -eq 'ResourceExists'){
142+
Write-Host 'resource exists.'
143+
}else{
144+
Write-Host 'error.'
145+
}
146+
}
147+
Write-Host 'created.'
148+
149+
}
150+
131151
function SetupMappingDictionary($StorageAccountKey)
132152
{
133153
# Set up the Mapping Dictionary

0 commit comments

Comments
 (0)