diff --git a/Common/Deployment/DeploymentLib.ps1 b/Common/Deployment/DeploymentLib.ps1 index 39b79e20..a1ca737f 100644 --- a/Common/Deployment/DeploymentLib.ps1 +++ b/Common/Deployment/DeploymentLib.ps1 @@ -953,6 +953,26 @@ function FixWebJobZip() $zip.Dispose() } +function ResourceObjectExists + { + Param( + [Parameter(Mandatory=$true,Position=0)] [string] $resourceGroupName, + [Parameter(Mandatory=$true,Position=1)] [string] $resourceName, + [Parameter(Mandatory=$true,Position=2)] [string] $type + ) + return (GetResourceObject -resourceGroupName $resourceGroupName -resourceName $resourceName -type $type | ?{$_.Name -eq $resourceName}) -ne $null + } + + function GetResourceObject + { + Param( + [Parameter(Mandatory=$true,Position=0)] [string] $resourceGroupName, + [Parameter(Mandatory=$true,Position=1)] [string] $resourceName, + [Parameter(Mandatory=$true,Position=2)] [string] $type + ) + return Get-AzureRmResource -ResourceName $resourceName -ResourceGroupName $resourceGroupName -ResourceType $type + } + # Variable initialization [int]$global:envSettingsChanges = 0; $global:timeStampFormat = "o" diff --git a/Common/Deployment/PrepareIoTSample.ps1 b/Common/Deployment/PrepareIoTSample.ps1 index dfa7a9c2..63c96147 100644 --- a/Common/Deployment/PrepareIoTSample.ps1 +++ b/Common/Deployment/PrepareIoTSample.ps1 @@ -98,7 +98,7 @@ else } } -$suiteExists = (Find-AzureRmResourceGroup -Tag @{Name="IotSuiteType";Value=$suiteType} | ?{$_.ResourceGroupName -eq $suiteName}) -ne $null +$suiteExists = (Find-AzureRmResourceGroup -Tag @{Name="IotSuiteType";Value=$suiteType} | ?{$_.name -eq $suiteName -or $_.ResourceGroupName -eq $suiteName}) -ne $null $resourceGroupName = (GetResourceGroup -Name $suiteName -Type $suiteType).ResourceGroupName $storageAccount = GetAzureStorageAccount $suiteName $resourceGroupName $cloudDeploy $iotHubName = GetAzureIotHubName $suitename $resourceGroupName $cloudDeploy @@ -132,7 +132,7 @@ if ($suiteExists) if (ResourceObjectExists $suitename $storageAccount.StorageAccountName Microsoft.Storage/storageAccounts) { $storageSku = GetResourceObject $suitename $storageAccount.StorageAccountName Microsoft.Storage/storageAccounts - $params += @{storageAccountSku=$($storageSku.Properties.AccountType)} + $params += @{storageAccountSku=$($storageSku.Sku.Name)} } if (ResourceObjectExists $suitename $iotHubName Microsoft.Devices/IotHubs) {