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!"
  • 相关阅读:
    easyui 如何引入
    图片切换展示效果
    渐变弹出层
    C# GEP基因化编程
    C#操作内存
    移动的彩虹
    收缩和展开效果
    用SQL语句,删除掉重复项只保留一条
    图片切换,带标题文字
    Sql Server快速建表
  • 原文地址:https://www.cnblogs.com/wuwei928/p/5144862.html
Copyright © 2011-2022 走看看