zoukankan      html  css  js  c++  java
  • power shell upload file to azure storage

    # Azure subscription-specific variables.
    $storageAccountName = "storage-account-name"
    $containerName = "container-name"
    
    # Find the local folder where this PowerShell script is stored.
    $currentLocation = Get-location
    $thisfolder = Split –parent $currentLocation
    
    # Upload files in data subfolder to Azure.
    $localfolder = "$thisfolderdata"
    $destfolder = "data"
    $storageAccountKey = (Get-AzureStorageKey -StorageAccountName $storageAccountName).Primary
    $blobContext = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey
    $files = Get-ChildItem $localFolder foreach($file in $files)
    {
      $fileName = "$localFolder$file"
      $blobName = "$destfolder/$file"
      write-host "copying $fileName to $blobName"
      Set-AzureStorageBlobContent -File $filename -Container $containerName -Blob $blobName -Context $blobContext -Force
    } 
    write-host "All files in $localFolder uploaded to $containerName!"
  • 相关阅读:
    qt串口
    视频笔记
    视频笔记3
    视频笔记2
    视频笔记1
    将VariantMap添加到数据库
    QT5.9笔记
    li里面input框贴顶
    html增加空格
    linux图形化界面管理工具宝塔面板
  • 原文地址:https://www.cnblogs.com/wuwei928/p/5144862.html
Copyright © 2011-2022 走看看