INC-3161 · P2 · Azure · Azure Files · SMB 3 · Point de terminaison privé · VPN Gateway point-à-site · PowerShell · Azure CLI

الحل خطوة بخطوة: لم تعد الوكالة الشرقية قادرة على فتح القرص المشترك الذي يضم ملفات الطلبة

حادث إنتاج يُعاد في طرفية محاكاة، مع حلّه الكامل: الأوامر التي كتبها مهندس المناوبة، وما أظهرته، والسبب والإصلاح. وهذا بالضبط هو التفكير المنتظر في مقابلة عمل لمنصب DevOps أو SRE أو مدير أنظمة لينكس.

جرّبها بنفسك أولًا في الطرفية (مجانًا)

التذكرة

تحفظ وكالات MasterLinux ملفات التسجيل (بطاقات التعريف الممسوحة، والعقود، والشهادات) في مشاركة Azure Files: \\stmlagences.file.core.windows.net\documents، مُركَّبة على شكل Z: في كل حاسوب.

في نهاية هذا الأسبوع، انتقلت الوكالة الشرقية إلى مقر جديد، مع جهاز ألياف بصرية جديد لدى مزوّد إنترنت آخر. وهذا الصباح لم يعد أي حاسوب قادرًا على تركيب Z:. أما المقر الرئيسي والآلات الافتراضية في Azure فتصل إليها دون مشكلة. اثنا عشر تسجيلًا مبرمجة اليوم، والفريق لا يستطيع لا حفظ الملفات ولا الاطلاع عليها.

أنت في فريق الدعم، متصل بحاسوب الوكالة ml-poste-07 (Windows 11، PowerShell، و Azure CLI مثبّتة). ملف VPN من نقطة إلى موقع (point-to-site) الخاص بـ MasterLinux مثبّت على حواسيب الوكالات، لكن لا أحد يستعمله عادةً.

المنهجية، أمرًا بأمر

هذه هي الأوامر التي كتبها المهندس، بالترتيب، مع ما أجاب به الجهاز.

  1. PS C:\Users\support> net use Z: \\stmlagences.file.core.windows.net\documents /persistent:yes
    System error 53 has occurred.
    
    The network path was not found.
  2. PS C:\Users\support> cmdkey /list
    Currently stored credentials:
    
        Target: Domain:target=stmlagences.file.core.windows.net
        Type: Domain Password
        User: localhost\stmlagences
        Local machine persistence
    
    (محاكاة: كلمة المرور المحفوظة تطابق key1، التي تبدأ بـ Zk3v، دون تغيير منذ 2 مارس.)
  3. PS C:\Users\support> az storage account keys list -g rg-agences -n stmlagences
    [
      {
        "creationTime": "2026-03-02T10:41:18.553201+00:00",
        "keyName": "key1",
        "permissions": "FULL",
        "value": "Zk3v…Qw=="
      },
      {
        "creationTime": "2026-03-02T10:41:18.553201+00:00",
        "keyName": "key2",
        "permissions": "FULL",
        "value": "p9Rb…Ag=="
      }
    ]
  4. PS C:\Users\support> az storage share-rm list -g rg-agences --storage-account stmlagences -o table
    Name       Kind                                      QuotaGiB    EnabledProtocols    AccessTier    ResourceGroup
    ---------  ----------------------------------------  ----------  ------------------  ------------  ---------------
    documents  Microsoft.Storage/storageAccounts/fileServices/shares  1024  SMB         TransactionOptimized  rg-agences
  5. PS C:\Users\support> az storage account show -g rg-agences -n stmlagences --query "{public:publicNetworkAccess, regles:networkRuleSet}"
    {
      "public": "Enabled",
      "regles": {
        "bypass": "AzureServices",
        "defaultAction": "Deny",
        "ipRules": [
          { "action": "Allow", "ipAddressOrRange": "196.200.131.18" },
          { "action": "Allow", "ipAddressOrRange": "105.159.47.82" }
        ],
        "virtualNetworkRules": []
      },
      "privateEndpointConnections": [
        {
          "name": "pe-stmlagences-file.6c1e9a3b",
          "privateLinkServiceConnectionState": { "status": "Approved" }
        }
      ]
    }
  6. PS C:\Users\support> az vm run-command invoke -g rg-agences -n ml-app-01 --command-id RunPowerShellScript --scripts "Test-NetConnection stmlagences.file.core.windows.net -Port 445; net use Y: \\stmlagences.file.core.windows.net\documents"
    {
      "value": [
        {
          "code": "ComponentStatus/StdOut/succeeded",
          "displayStatus": "Provisioning succeeded",
          "level": "Info",
          "message": "ComputerName     : stmlagences.file.core.windows.net\nRemoteAddress    : 10.20.1.5\nRemotePort       : 445\nInterfaceAlias   : Ethernet\nSourceAddress    : 10.20.4.11\nTcpTestSucceeded : True\n\nDrive Y: is now connected to \\\\stmlagences.file.core.windows.net\\documents.\nThe command completed successfully.",
          "time": null
        },
        {
          "code": "ComponentStatus/StdErr/succeeded",
          "displayStatus": "Provisioning succeeded",
          "level": "Info",
          "message": "",
          "time": null
        }
      ]
    }
  7. PS C:\Users\support> Resolve-DnsName stmlagences.file.core.windows.net
    Name                           Type   TTL   Section    NameHost
    ----                           ----   ---   -------    --------
    stmlagences.file.core.windows.net CNAME 60  Answer     stmlagences.privatelink.file.core.windows.net
    stmlagences.privatelink.file.core.windows.net CNAME 60 Answer file.par21prdstr03a.store.core.windows.net
    
    Name       : file.par21prdstr03a.store.core.windows.net
    QueryType  : A
    TTL        : 60
    Section    : Answer
    IP4Address : 20.60.153.72
  8. PS C:\Users\support> Test-NetConnection -ComputerName stmlagences.file.core.windows.net -Port 445
    WARNING: TCP connect to (20.60.153.72 : 445) failed
    WARNING: Ping to 20.60.153.72 failed with status: TimedOut
    
    
    ComputerName           : stmlagences.file.core.windows.net
    RemoteAddress          : 20.60.153.72
    RemotePort             : 445
    InterfaceAlias         : Ethernet
    SourceAddress          : 192.168.1.23
    PingSucceeded          : False
    PingReplyDetails (RTT) : 0 ms
    TcpTestSucceeded       : False
  9. PS C:\Users\support> Test-NetConnection -ComputerName stmlagences.file.core.windows.net -Port 443
    ComputerName     : stmlagences.file.core.windows.net
    RemoteAddress    : 20.60.153.72
    RemotePort       : 443
    InterfaceAlias   : Ethernet
    SourceAddress    : 192.168.1.23
    TcpTestSucceeded : True
  10. PS C:\Users\support> Get-VpnConnection
    Name                  : VPN-MasterLinux-Azure
    ServerAddress         : azuregateway-4f1c7a2e-9b3d-4e6a-8c0f-1d5e7a9b3c24-61a0e2b9d7f3.vpn.azure.com
    AllUserConnection     : True
    Guid                  : {6A2E8C1F-3B5D-4F7A-9E0C-2D4B6F8A1C3E}
    TunnelType            : Sstp
    AuthenticationMethod  : {MachineCertificate}
    EncryptionLevel       : Required
    L2tpIPsecAuth         :
    UseWinlogonCredential : False
    EapConfigXmlStream    :
    ConnectionStatus      : Disconnected
    RememberCredential    : True
    SplitTunneling        : True
    DnsSuffix             : masterlinux.lab
    IdleDisconnectSeconds : 0
  11. PS C:\Users\support> rasdial "VPN-MasterLinux-Azure"
    Connecting to VPN-MasterLinux-Azure...
    Verifying username and password...
    Registering your computer on the network...
    Successfully connected to VPN-MasterLinux-Azure.
    Command completed successfully.
  12. PS C:\Users\support> Resolve-DnsName stmlagences.file.core.windows.net
    Name                           Type   TTL   Section    NameHost
    ----                           ----   ---   -------    --------
    stmlagences.file.core.windows.net CNAME 60  Answer     stmlagences.privatelink.file.core.windows.net
    
    Name       : stmlagences.privatelink.file.core.windows.net
    QueryType  : A
    TTL        : 10
    Section    : Answer
    IP4Address : 10.20.1.5
  13. PS C:\Users\support> Test-NetConnection -ComputerName stmlagences.file.core.windows.net -Port 445
    ComputerName     : stmlagences.file.core.windows.net
    RemoteAddress    : 10.20.1.5
    RemotePort       : 445
    InterfaceAlias   : VPN-MasterLinux-Azure
    SourceAddress    : 172.16.201.2
    TcpTestSucceeded : True
  14. PS C:\Users\support> net use Z: \\stmlagences.file.core.windows.net\documents /persistent:yes
    Drive Z: is now connected to \\stmlagences.file.core.windows.net\documents.
    
    The command completed successfully.

ما كشفته هذه الأوامر

السبب الجذري

مزوّد الإنترنت الجديد للوكالة يحجب الحركة الصادرة نحو المنفذ TCP 445 (SMB): الاتصال لا يصل أبدًا إلى Azure

تعني «System error 53» أن Windows لم يتمكن حتى من فتح اتصال مع خادم SMB: لم نصل بعد إلى مرحلة المصادقة. من الوكالة، يفشل Test-NetConnection -Port 445 بينما يجيب المنفذ 443 للحساب نفسه: يمكن الوصول إلى Azure، وحده المنفذ 445 الصادر يُرشَّح في الطريق. وهذه ممارسة شائعة لدى مزوّدي الإنترنت الموجّهين للعموم (استُعمل المنفذ 445 في موجات كبيرة من الديدان)، وهذا بالضبط ما تغيّر في نهاية الأسبوع مع الجهاز الجديد.

المفتاح هو نفسه منذ مارس (ويعمل من آلة Azure)، والمشاركة موجودة، وجدار حماية الحساب يسمح بعنوان الوكالة: خطأ في المفتاح كان سيعطي «Access is denied» (الخطأ 5 أو 86)، ورفض جدار الحماية أو غياب المشاركة يعطيان خطأ بعد اتصال TCP.

التحليل والإصلاح

التصحيح الفوري: تمرير SMB عبر VPN من نقطة إلى موقع الخاص بـ MasterLinux، الذي ينتهي في الشبكة الافتراضية حيث توجد نقطة النهاية الخاصة للحساب:

  • rasdial "VPN-MasterLinux-Azure"؛
  • التحقق من أن الاسم صار يُحَلّ إلى عنوان خاص (Resolve-DnsName stmlagences.file.core.windows.net ← 10.20.1.5) وأن Test-NetConnection … -Port 445 ينجح؛
  • إعادة تركيب القرص: net use Z: \\stmlagences.file.core.windows.net\documents /persistent:yes.

حتى لا يتكرر ذلك:

  • VPN دائم للوكالة: نفق من موقع إلى موقع انطلاقًا من الموجّه (أو VPN «Always On» على الحواسيب) بدل الوصول إلى SMB عبر الإنترنت؛
  • أو Azure File Sync على خادم محلي صغير في الوكالة، يحتفظ بذاكرة مؤقتة ولا يتحدث مع Azure إلا عبر HTTPS (443)؛
  • لاحقًا، تعطيل الوصول العام إلى الحساب (publicNetworkAccess Disabled) لقبول نقطة النهاية الخاصة وحدها؛
  • إضافة «المنفذ 445 الصادر مفتوح» إلى قائمة التحقق في كل انتقال أو تغيير لجهاز الإنترنت.

في مقابلة العمل

يتكرّر هذا النوع من الأعطال كثيرًا في المقابلات التقنية («الموقع يُرجع خطأ، ماذا تفعل؟»). وما يُقيَّم هو: الانطلاق من الأعراض، وفحص كل طبقة بالأمر المناسب، وإثبات السبب قبل الإصلاح، ثم منع تكراره. يدرّبك MasterLinux على 195 حادثًا من هذا النوع، من المبتدئ إلى الخبير.

جرّبها بنفسك أولًا في الطرفية (مجانًا)

افتح كل محاكاة الإنتاج

AWS وAzure وGoogle Cloud والخوادم المحلية والسحابات المتعددة، من المبتدئ إلى المتطرف: الحوادث الحقيقية لشركات الخدمات الرقمية والشركات الكبرى للمعلوميات، متاحة لمدة سنة.

حلول مجانية أخرى