Advertisement
Guest User

Untitled

a guest
Jun 13th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. $StorageAccount = Get-AzureRmStorageAccount -ResourceGroupName $ResourceGroupName -Name $StorageAccountName
  2.  
  3. $blob = Get-AzureStorageBlob -Context $StorageAccount.Context -Container "Database name" -Blob "CreateNewPartition.xmla"
  4.  
  5. $file = $blob.ICloudBlob.DownloadText()
  6. Invoke-ASCmd `
  7. -Database $AnalysisServiceDatabase `
  8. -InputFile $file `
  9. -server $AnalysisServiceServer
  10.  
  11. $memStream = New-Object System.IO.MemoryStream
  12. $blob.ICloudBlob.DownloadToStream($memStream)
  13. $readStream = New-Object System.IO.StreamReader($memStream, [System.Text.Encoding]::Unicode)
  14. $memStream.Position = 0
  15. $file = ($readStream.ReadToEnd() -replace "`0",'' | ConvertFrom-Json)
  16.  
  17. $byteArray = New-Object Byte[] $blob.Length
  18. $file = $blob.ICloudBlob.DownloadToByteArray($byteArray, 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement