logo
down
shadow

How get a row in Azure Storage tables using PowerShell?


How get a row in Azure Storage tables using PowerShell?

By : sakshi
Date : November 19 2020, 03:01 PM
like below fixes the issue I found that the error is because of some problem in AzureRmStorageTable V1.0.0.17. I have updated it to V1.0.0.20, and it's working now. In documentation of V1.0.0.20, they wrote: 'Implemented some measures in order to avoid conflicts between different assembly versions, more specifically Microsoft.WindowsAzure.Storage.Dll.'
I can't remember that which version was installed on the Runbooks by default, anyway, it will work if you update it.
code :


Share : facebook icon twitter icon
azure function powershell read from storage queue and write to storage table

azure function powershell read from storage queue and write to storage table


By : Arnel Capacio
Date : March 29 2020, 07:55 AM
Does that help Recently I did the same function and you can find the examples here. You need the function QueueTrigger-PowerShell. hth
code :
$json = Get-Content $triggerInput | ConvertFrom-Json
Write-Output "PowerShell script processed queue message '$json'"

$title = "PowerShell Table Entity for message {0}" -f $json.id
$entity = [PSObject]@{
  Status = 0
  Title = $title
}

$entity | ConvertTo-Json | Out-File -Encoding UTF8 $outputTable
{
  "type": "table",
  "name": "outputTable",
  "tableName": "pancakeTable",
  "connection": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
  "direction": "out",
  "partitionKey": "some value",
  "rowKey": "I don't remember what was here but it was some form of variable (guid) generated from the request by Azure"
}
PartitionKey = $requestBody.room  
RowKey = get-date -Format "yyyy-MM-dd H:m:s.ms"
Delete tables from azure storage account older than 3 months with PowerShell

Delete tables from azure storage account older than 3 months with PowerShell


By : Luca Schumann
Date : March 29 2020, 07:55 AM
it fixes the issue You'll need to store this table-creation-date metadata yourself, to query later (whether in another Azure Table or anywhere else). And then come up with some type of periodic scanning of this metadata to look for creation dates > 90 days. And how you accomplish this is really up to you - lots of options...
Also: Unlike Blobs, Tables don't have associated metadata properties, so you cannot store this metadata directly attached to a Table.
How retrieve all of records in Azure storage tables using PowerShell or Azure CLI

How retrieve all of records in Azure storage tables using PowerShell or Azure CLI


By : Xavier Beauchamp
Date : March 29 2020, 07:55 AM
Does that help This was a bug in the CLI. A fix will be out in our next release, v2.0.32. Basically the properties being given to the --marker parameter weren't being parsed out.
Read here for more info: https://github.com/Azure/azure-cli/issues/6194
Use Powershell to get blob from Azure Storage without using the Azure PowerShell module

Use Powershell to get blob from Azure Storage without using the Azure PowerShell module


By : Chris M
Date : March 29 2020, 07:55 AM
hope this fix your issue Turns out there is a little mistake in the docs, you need a newline after CanonicalizedHeaders as well, even if the docs says otherwise. If you read carefully the next code example in the docs they actually have that newline there:
code :
PUT\n\ntext/plain; charset=UTF-8\n\nx-ms-date:Sun, 20 Sep 2009 20:36:40 GMT\nx-ms-meta-m1:v1\nx-ms-meta-m2:v2\n/testaccount1/mycontainer/hello.txt
function GenerateHeader(
    [string]$accountName,
    [string]$accountKey,
    [string]$verb,
    [string]$resource)
{
    $xmsversion = '2015-02-21'
    $xmsdate = Get-Date
    $xmsdate = $xmsdate.ToUniversalTime()
    $xmsdate = $xmsdate.toString('R')

    $newLine = "`n";

    $contentType = 'application/json'

    $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
    $headers.Add("Content-Type", $contentType)
    $headers.Add("x-ms-date", $xmsdate)
    $headers.Add("x-ms-version", $xmsversion)

    $canonicalizedHeaders = "x-ms-date:$xmsdate"+$newLine+"x-ms-version:$xmsversion"
    $canonicalizedResource = $resource

    $stringToSign = $verb.ToUpper() + $newLine +`
                $contentMD5 + $newLine +`
                $contentType + $newLine +`
                $dateHeader + $newLine +`
                $canonicalizedHeaders + $newLine +`
                $canonicalizedResource;

    $hmacsha = New-Object System.Security.Cryptography.HMACSHA256
    $hmacsha.key = [Convert]::FromBase64String($accountKey)
    $signature = $hmacsha.ComputeHash([Text.Encoding]::UTF8.GetBytes($stringToSign))
    $signature = [Convert]::ToBase64String($signature)
    $headers.Add("Authorization", "SharedKeyLite " + $accountName + ":" + $signature)

    return $headers
}

$accountName = ''
$accountKey = ''
$container = ''
$fileName = ''

$blobUri = "https://$accountName.blob.core.windows.net/$container/$fileName"
$outputPath = "$PSScriptRoot\$fileName"
$headers = GenerateHeader $accountName $accountKey 'GET' "/$accountName/$container/$fileName"

$webClient = New-Object System.Net.WebClient

foreach ($key in $headers.Keys)
{
    $webClient.Headers.Add($key, $headers[$key])
}

$start_time = Get-Date
$webClient.DownloadFile($blobUri, $outputPath)
Write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
Write-Output $stringToSign
How to calculate size of all Azure Storage Tables from a Subscription using Powershell

How to calculate size of all Azure Storage Tables from a Subscription using Powershell


By : Nicolas
Date : March 29 2020, 07:55 AM
this will help You can calculate the size of all Azure Storage Tables, but the minimum granularity could just be all the tables in a storage account, not a specific table.
Try the command as below, it works fine on my side.
code :
$StorageAccounts = Get-AzStorageAccount
foreach($item in $StorageAccounts){
    $id = $item.Id+"/tableServices/default"
    $name = $item.StorageAccountName
    $metric = Get-AzMetric -ResourceId $id -MetricName "TableCapacity" -WarningAction Ignore
    $data = $metric.Data.Average/1024/1024
    Write-Output "Tables in $name : $data MB"
}
Set-AzContext -SubscriptionId "xxxx-xxxx-xxxx-xxxx"
Related Posts Related Posts :
  • Creating index file for import into document management system using PowerShell
  • Generate 2 different list in one foreach loop with powershell
  • Powershell write IF statement into a Variable
  • Powershell works differently for two similar operation
  • Download Files from TFS based on theirs labes using powershell
  • Remove multiple licenses via Azure AD v2 powershell
  • Display Multiple pipeline Values Of Same Get-Content
  • Powershell accessing command line arguments
  • variable outputs duplicates
  • Get a user's OU group based on a file that was created
  • Different results in PS shell and cmd.exe shell
  • Copy Files Not Directory Structure
  • PowerShell function as parameter in function
  • How to make a Powershell script answer a prompt for user input?
  • How do I query a file on FTP server in PowerShell to determine if an upload is required?
  • Powershell - convert local time to different timezone
  • Powershell Logging within modules and dot sourced scripts
  • Start process with path space
  • In PowerShell how can I compare objects with different properties and retain the original properties from the Reference
  • ParseInput changes the out Tokens based on the comments in the script
  • Add a member to a group from another domain
  • Powershell invoke-command access is denied error - not a double hop
  • Green frames / no subtitles in converted files of watching directory (Powershell) using HandbrakeCLI + JSON preset
  • Installing 'printer forms' using powershell without prnadmin.dll?
  • How to pass around a PowerShell DSC Configuration as an object?
  • Literal quotes in "Powershell Start-Process -ArgumentList"
  • Delete multiple lines in a text file using Powershell
  • How run a command in PowerShell from a specified directory and wait for it to complete before moving on?
  • InvokeWebRequest - Continue reading file after 4XX/5XX error
  • Powershell script to find currently bound expiring certificates in IIS remotely
  • How to view all properties of an AD User object?
  • Printing useful variable values in powershell (in particular, involving $null/empty string)
  • Output formatting is truncating properties when long strings are present
  • Powershell script to get FullName of a Directory tree
  • PowerShell to open gzip stream
  • How to get the Config Blob Uri parameter from restored VHD from Azure Recovery Services Vault in Powershell?
  • Get Directory Name from FileInfo object
  • Is there a way how to use [switch] parameter in Azure Runbook
  • Powershell: appending a percent sign to the end of a variable
  • Rename all folders with given name in a directory using powershell
  • Array of hash tables not output
  • Powershell SQL Query to variables
  • How to Stop-Process by command line parameters?
  • Trying to return only ipv4 address from hostname
  • How to get vmware vm list which has more than 25% of used space of the particular datastore using powershell?
  • Strange behavior of Import-Module
  • getting property value in powershell when running convertto-html
  • Inconsistency in results of calling Get-AuthenticodeSignature from PowerShell, often says NotSigned
  • How to fix psexec not running PowerShell script on VM?
  • download file/s from OneDrive with Powershell
  • Classic ASP - Display List of Timezones using powershell
  • match array to multiple regex (from array)
  • docker and elevated priv
  • Office 365 group classifications: How to restrict users from changing classification after the creation of the group
  • Adding variable to Invoke-RestMethod
  • Param with more values
  • How can I check how many lines my command for searching processes printed?
  • How to update global variable in another file in PowerShell?
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org