設定 Azure Portal 存取 Azure Storage Files

一直以來我需要 Linux 環境時都是建立在 Azure 上,一來是沒有自己的硬體,二來是可以無痛快速重建整個環境,練習 Kubernetes 更是如此,可以滿足動態增減機器的需求,缺點就是費用會隨著使用時間增加。

最近因為專案需要使用到 Kubernetes - Persistent Volume,過去只用過 hostpath,在嘗試 Azure Files 時遇到一個 Azure 的設定問題,所以額外筆記一下

重現問題:Access denied

  1. 在 Azure 上建立 Storage Account

    1storageaccount

    設定請依實際情境調整,以下僅提供個人使用範例

    2setting

  2. Storage accpunts –> 選擇目標 account –> Files

    • 錯誤訊息

      Access denied
      
      You do not have access
      
      Server failed authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
      
    • 錯誤截圖

      3accessdeny

  3. Access denied 解決方式

    • Storage account –> 目標 account –> Access control (IAM)

      4iam

    • 設定權限

      可以接受的權限有

      • Azure Resource Manager Owner
      • Azure Resource Manager Contributor
      • Storage Account Contributor

      6addrole

      5addroleassignment

重現問題:Authorization failure

Storage accpunts –> 選擇目標 account –> Files

  • 錯誤訊息

    Authorization failure
    
    You do not have access
    
    An authorization failure occurred. Recent changes to 'Firewalls and virtual networks' settings may not be in effect yet. If you have recently changed these settings, try waiting for up to a minute, then revisit this experience. The error was: 'code: AuthorizationFailure.
    
  • 錯誤截圖

    7thfail

  • Authorization failure 解決方式

    將目前使用 ip 加入 access 清單中: Firewalls and virtual networks –> Add your IP address

    8addclientip

心得

每次需要用到雲端服務時難免會有些擔憂,不論是 Azure 還是 GCP 都一樣:我需要一個功能或是服務,看著畫面憑著直覺設定,卻不時遇到無法使用的狀況,有時是權限沒設定、有時是網路沒開通,雖然都是些小設定,但常常因為這些小設定卡了幾個小時,原因是訊息常常不夠明確,而官網文件也常跟畫面對不起來也是問題,除此之外 Azure 文件則是太偏介紹,文件裡連結連來連去,常常得花不少時間才能得到正確答案

參考資訊

  1. Use the Azure portal to access blob or queue data
  2. Azure Storage redundancy
  3. Azure storage account overview
  4. Create a storage account
  5. Configure Azure Storage firewalls and virtual networks