mirror of
https://dev.azure.com/effectory/Survey%20Software/_git/Cloud%20Engineering
synced 2026-02-27 18:52:18 +01:00
Added more storage scripts #115638
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
param (
|
||||
[string] $subscriptionId = "",
|
||||
[string] $resourcegroupName = "",
|
||||
[string] $storageAccountName = ""
|
||||
[string] $storageAccountName = "",
|
||||
[string[]] $specificTables = @()
|
||||
)
|
||||
|
||||
if (("" -eq $subscriptionId) -or ("" -eq $resourcegroupName) -or ("" -eq $storageAccountName)) {
|
||||
@@ -34,6 +35,21 @@ $fileName = ".\$date - $storageAccountName - tablecheck.csv"
|
||||
# .\AzureStorageTableQuery.ps1 -subscriptionId "6e2b45e4-5e7b-4628-8827-ec44e23d2f6b" -resourcegroupName "ParticipantIntegration-Settings" -storageAccountName "integrationsettings"
|
||||
# .\AzureStorageTableQuery.ps1 -subscriptionId "6e2b45e4-5e7b-4628-8827-ec44e23d2f6b" -resourcegroupName "ParticipantIntegration" -storageAccountName "participantintegration"
|
||||
|
||||
|
||||
# .\AzureStorageTableQuery.ps1 -subscriptionId "a134faf1-7a89-4f2c-8389-06d00bd5e2a7" -resourcegroupName "effectorycore" -storageAccountName "coremailings" -specificTables "Recipients"
|
||||
|
||||
# .\AzureStorageTableQuery.ps1 -subscriptionId "7feeb150-9ee0-4aea-992a-5f3a89d933e6" -resourcegroupName "results-activity" -storageAccountName "effactivity" -specificTables "MeasurementParticipants"
|
||||
# .\AzureStorageTableQuery.ps1 -subscriptionId "e33c30f7-06c7-4765-86a9-7a8979b6d1cc" -resourcegroupName "EffectoryPublicApi" -storageAccountName "effectorypublicapi"
|
||||
# .\AzureStorageTableQuery.ps1 -subscriptionId "86945e42-fa5a-4bbc-948f-3f5407f15d3e" -resourcegroupName "hierarchy" -storageAccountName "hierarchyeff"
|
||||
|
||||
|
||||
# .\AzureStorageTableQuery.ps1 -subscriptionId "6e2b45e4-5e7b-4628-8827-ec44e23d2f6b" -resourcegroupName "ParticipantIntegration-Settings" -storageAccountName "integrationsettings"
|
||||
|
||||
# .\AzureStorageTableQuery.ps1 -subscriptionId "8c282de4-a7df-458e-b151-e10ca7b49966" -resourcegroupName "my-effectory-project-settings" -storageAccountName "projectsettingseffectory" -specificTables "Project"
|
||||
# .\AzureStorageTableQuery.ps1 -subscriptionId "fced11a2-8ba7-4596-9ff4-de8b47713c48" -resourcegroupName "ResultIntegration" -storageAccountName "resultintegration"
|
||||
|
||||
# .\AzureStorageTableQuery.ps1 -subscriptionId "7feeb150-9ee0-4aea-992a-5f3a89d933e6" -resourcegroupName "results-calculation" -storageAccountName "resultscalculation" -specificTables "Calculations" , "SurveyParticipants"
|
||||
|
||||
$surveys = @(3884,
|
||||
4401,
|
||||
4426,
|
||||
@@ -11068,7 +11084,11 @@ $subscription = Set-AzContext -SubscriptionId $subscriptionId
|
||||
$storageAccount = Get-AzStorageAccount -ResourceGroupName $resourcegroupName -Name $storageAccountName
|
||||
|
||||
|
||||
$tables = Get-AzStorageTable -Context $storageAccount.Context #-Name "integrationeventstore"
|
||||
$tables = Get-AzStorageTable -Context $storageAccount.Context
|
||||
|
||||
if ($specificTables.Length -gt 0) {
|
||||
$tables = $tables | Where-Object { $specificTables -contains $_.Name }
|
||||
}
|
||||
|
||||
foreach ($table in $tables) {
|
||||
|
||||
@@ -11085,36 +11105,35 @@ foreach ($table in $tables) {
|
||||
$obj = $row
|
||||
#$obj = $row.Payload | ConvertFrom-Json
|
||||
|
||||
# if (($null -ne $obj) -and ($null -ne $obj.SurveyId)) {
|
||||
if (($null -ne $obj)-and ($null -ne $obj.SurveyId)) {
|
||||
|
||||
# $survey = [int] $obj.SurveyId
|
||||
$survey = [int] $obj.SurveyId
|
||||
|
||||
# if ($surveys -contains $survey) {
|
||||
# Write-Warning "Found surveyId that should have been deleted: [$($survey)]"
|
||||
if ($surveys -contains $survey) {
|
||||
Write-Warning "Found surveyId that should have been deleted: [$($survey)]"
|
||||
|
||||
# [TableCheck] $tableCheck = [TableCheck]::new()
|
||||
# $tableCheck.SubscriptionId = $subscription.Subscription.Id
|
||||
# $tableCheck.SubscriptionName = $subscription.Subscription.Name
|
||||
# $tableCheck.ResourcegroupName = $resourcegroupName
|
||||
# $tableCheck.StorageAccountName = $storageAccountName
|
||||
# $tableCheck.TableName = $table.Name
|
||||
# $tableCheck.SurveyId = $survey
|
||||
# $tableCheck.Message = "Found surveyId that should have been deleted: [$($survey)]"
|
||||
# $Result += $tableCheck
|
||||
# }
|
||||
# else {
|
||||
# Write-Information "SurveyId is ok: [$($survey)]"
|
||||
# }
|
||||
# }
|
||||
# else {
|
||||
# Write-Information "Found row with no SurveyId"
|
||||
# }
|
||||
[TableCheck] $tableCheck = [TableCheck]::new()
|
||||
$tableCheck.SubscriptionId = $subscription.Subscription.Id
|
||||
$tableCheck.SubscriptionName = $subscription.Subscription.Name
|
||||
$tableCheck.ResourcegroupName = $resourcegroupName
|
||||
$tableCheck.StorageAccountName = $storageAccountName
|
||||
$tableCheck.TableName = $table.Name
|
||||
$tableCheck.SurveyId = $survey
|
||||
$tableCheck.Message = "Found surveyId that should have been deleted: [$($survey)]"
|
||||
$Result += $tableCheck
|
||||
}
|
||||
else {
|
||||
Write-Host "SurveyId is ok: [$($survey)]"
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host "Found row with no SurveyId"
|
||||
}
|
||||
|
||||
if ($null -ne $obj.PartitionKey) {
|
||||
if ($null -ne $obj.AccountId){
|
||||
|
||||
# $account = [int] $obj.AccountId
|
||||
$account = [int] $obj.PartitionKey
|
||||
|
||||
$account = [int] $obj.AccountId
|
||||
|
||||
if ($accounts -contains $account) {
|
||||
Write-Warning "Found accountId that should have been deleted: [$($account)]"
|
||||
|
||||
@@ -11129,11 +11148,11 @@ foreach ($table in $tables) {
|
||||
$Result += $tableCheck
|
||||
}
|
||||
else {
|
||||
Write-Information "AccountId is ok: [$($account)]"
|
||||
Write-Host "AccountId is ok: [$($account)]"
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Information "Found row with no AccountId"
|
||||
Write-Host "Found row with no AccountId"
|
||||
}
|
||||
|
||||
if ($Result.Length -gt 0) {
|
||||
|
||||
Reference in New Issue
Block a user