{"record":{"id":"8476bcb83f0566cf","repo":"oven-sh/bun","slug":"azure-failed-to-get-public-ip-for-vmname","errorCode":null,"errorMessage":"[azure] Failed to get public IP for ${vmName}","messagePattern":"\\[azure\\] Failed to get public IP for (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/azure.mjs","lineNumber":512,"sourceCode":"      tags: tags\n        ? Object.fromEntries(\n            Object.entries(tags)\n              .filter(([_, v]) => v != null)\n              .map(([k, v]) => [k, String(v)]),\n          )\n        : undefined,\n    });\n\n    // Wait for public IP to be assigned\n    let publicIp;\n    for (let i = 0; i < 30; i++) {\n      publicIp = await getPublicIpAddress(publicIpName);\n      if (publicIp) break;\n      await new Promise(r => setTimeout(r, 5000));\n    }\n\n    if (!publicIp) {\n      throw new Error(`[azure] Failed to get public IP for ${vmName}`);\n    }\n\n    console.log(`[azure] VM created: ${vmName} at ${publicIp}`);\n\n    // Use Azure Run Command for all remote operations instead of SSH.\n    // This avoids the sshd startup issues on Azure Windows VMs.\n\n    const spawnFn = async (command, opts) => {\n      const script = command.join(\" \");\n      console.log(`[azure] Run: ${script}`);\n      // Note: Azure Run Command output is limited to the last 4096 bytes.\n      // Full output is not available — only the tail is returned.\n      // value[0] = stdout (ComponentStatus/StdOut), value[1] = stderr (ComponentStatus/StdErr)\n      const result = await runCommand(vmName, [script]);\n      const values = result?.value ?? [];\n      const stdout = values[0]?.message ?? \"\";\n      const stderr = values[1]?.message ?? \"\";\n      if (opts?.stdio === \"inherit\") {","sourceCodeStart":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/scripts/azure.mjs#L494-L530","documentation":"Thrown by the Azure VM creation flow in scripts/azure.mjs after it polls getPublicIpAddress() 30 times at 5-second intervals (~2.5 minutes) and never receives an address. It means the public IP resource was created but Azure never assigned it an ipAddress value.","triggerScenarios":"createVm completes, but the attached public IP stays pending/empty — Azure provisioning delays, region capacity pressure, public-IP quota exhaustion, or a failed allocation on the IP resource.","commonSituations":"Transient Azure provisioning slowness in busy regions; hitting the subscription's regional public IP quota after creating/deleting many CI VMs in a short window; Azure service incidents affecting networking.","solutions":["Re-run the job — most assignments succeed on a fresh attempt","Inspect the resource: az network public-ip show -g <resource-group> -n <ip-name> and check provisioningState/ipAddress","Verify quota with az network list-usages and check Azure region health","If the IP object is stuck, delete it and retry so the script creates a new one"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await azure.create();\n} catch (e) {\n  if (e.message.includes(\"Failed to get public IP\")) {\n    await new Promise(r => setTimeout(r, 60_000)); // let Azure catch up\n    return azure.create(); // one fresh attempt\n  }\n  throw e;\n}","preventionTips":["Treat VM creation as retryable at the CI-job level","Alert when polling consistently exceeds the 30x5s window so quota or outage issues surface early"],"tags":["azure","network","ci","vm","retry"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}