Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save lassebenni/81b7f9633b36d2fbff623eb19667144c to your computer and use it in GitHub Desktop.

Select an option

Save lassebenni/81b7f9633b36d2fbff623eb19667144c to your computer and use it in GitHub Desktop.
Terminal Tutorial: re-running an imperative az create
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Terminal Tutorial: re-running an imperative az create</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
background: #1a1a2e;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
padding: 24px;
}
.frame {
width: 100%;
max-width: 880px;
background: #0d1117;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}
.titlebar {
background: #161b22;
padding: 10px 14px;
display: flex;
align-items: center;
gap: 8px;
border-bottom: 1px solid #21262d;
}
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.r { background: #ff5f56; }
.dot.y { background: #ffbd2e; }
.dot.g { background: #27c93f; }
.titlebar .title {
color: #8b949e;
font-size: 12px;
flex: 1;
text-align: center;
font-family: 'SF Mono', 'Fira Code', monospace;
}
.body {
padding: 18px 22px 26px;
font-family: 'SF Mono', 'Fira Code', 'Menlo', monospace;
font-size: 13.5px;
line-height: 1.55;
color: #c9d1d9;
}
.line { opacity: 0; }
.prompt { color: #58a6ff; }
.cmd { color: #f0f6fc; }
.cont { color: #f0f6fc; padding-left: 2ch; }
.info { color: #8b949e; }
.ok { color: #56d364; }
.warn { color: #d29922; }
.dim { color: #6e7681; font-style: italic; }
.blank { height: 8px; }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
.l01 { animation: appear 0.1s ease-out 0.3s forwards; }
.l02 { animation: appear 0.1s ease-out 0.7s forwards; }
.l03 { animation: appear 0.1s ease-out 0.9s forwards; }
.l04 { animation: appear 0.1s ease-out 1.1s forwards; }
.l05 { animation: appear 0.1s ease-out 1.3s forwards; }
.l06 { animation: appear 0.1s ease-out 1.5s forwards; }
.l07 { animation: appear 0.1s ease-out 2.6s forwards; }
.l08 { animation: appear 0.1s ease-out 3.0s forwards; }
.l09 { animation: appear 0.1s ease-out 3.4s forwards; }
.l10 { animation: appear 0.1s ease-out 3.8s forwards; }
.l11 { animation: appear 0.1s ease-out 4.0s forwards; }
.l12 { animation: appear 0.1s ease-out 4.2s forwards; }
.l13 { animation: appear 0.1s ease-out 4.4s forwards; }
.l14 { animation: appear 0.1s ease-out 4.6s forwards; }
.l15 { animation: appear 0.1s ease-out 5.6s forwards; }
.l16 { animation: appear 0.1s ease-out 6.0s forwards; }
.l17 { animation: appear 0.1s ease-out 6.4s forwards; }
.l18 { animation: appear 0.1s ease-out 7.2s forwards; }
.l19 { animation: appear 0.1s ease-out 7.6s forwards; }
.l20 { animation: appear 0.1s ease-out 8.0s forwards; }
.l21 { animation: appear 0.1s ease-out 8.4s forwards; }
.l22 { animation: appear 0.1s ease-out 9.2s forwards; }
.l23 { animation: appear 0.1s ease-out 9.6s forwards; }
.l24 { animation: appear 0.1s ease-out 10.0s forwards; }
.l25 { animation: appear 0.1s ease-out 10.6s forwards; }
.l26 { animation: appear 0.1s ease-out 11.0s forwards; }
.replay {
position: fixed;
bottom: 24px;
right: 24px;
background: #1f6feb;
color: white;
border: none;
padding: 8px 14px;
border-radius: 4px;
font-family: 'SF Mono', monospace;
font-size: 12px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="frame">
<div class="titlebar">
<span class="dot r"></span>
<span class="dot y"></span>
<span class="dot g"></span>
<span class="title">~/week-14 — bash</span>
</div>
<div class="body" id="body">
<div class="line l01"><span class="dim"># Is an imperative `az create` script safe to re-run? Let's find out.</span></div>
<div class="line l02 blank"></div>
<div class="line l03"><span class="prompt">$ </span><span class="cmd">export CLASS_RG=rg-hyf-students</span></div>
<div class="line l04"><span class="prompt">$ </span><span class="cmd">az storage account create \</span></div>
<div class="line l05"><span class="cont">--name sthyfdemo014 --resource-group "$CLASS_RG" \</span></div>
<div class="line l06"><span class="cont">--location westeurope --sku Standard_LRS --query provisioningState -o tsv</span></div>
<div class="line l07"><span class="ok">Succeeded</span></div>
<div class="line l08 blank"></div>
<div class="line l09"><span class="dim"># Now run the exact same command a second time.</span></div>
<div class="line l10"><span class="prompt">$ </span><span class="cmd">az storage account create \</span></div>
<div class="line l11"><span class="cont">--name sthyfdemo014 --resource-group "$CLASS_RG" \</span></div>
<div class="line l12"><span class="cont">--location westeurope --sku Standard_LRS --query provisioningState -o tsv</span></div>
<div class="line l13"><span class="warn">WARNING: A storage account with the provided name sthyfdemo014 is found.</span></div>
<div class="line l14"><span class="warn"> Will continue to update the existing account.</span></div>
<div class="line l15"><span class="ok">Succeeded</span></div>
<div class="line l16 blank"></div>
<div class="line l17"><span class="dim"># No error. And it is not a no-op either: change --sku and it applies.</span></div>
<div class="line l18"><span class="prompt">$ </span><span class="cmd">az storage account create ... --sku Standard_GRS --query sku.name -o tsv</span></div>
<div class="line l19"><span class="ok">Standard_GRS</span></div>
<div class="line l20 blank"></div>
<div class="line l21"><span class="dim"># Could I have previewed that? Not for this command. But az does have a preview:</span></div>
<div class="line l22"><span class="prompt">$ </span><span class="cmd">az deployment group what-if --help | head -2</span></div>
<div class="line l23"><span class="info">az deployment group what-if : Execute a deployment What-If operation.</span></div>
<div class="line l24 blank"></div>
<div class="line l25"><span class="dim"># Same CLI. A deployment carries a declared desired state, so Azure can</span></div>
<div class="line l26"><span class="dim"># diff it against reality. A one-off create has nothing to compare.</span></div>
</div>
</div>
<button class="replay" onclick="document.getElementById('body').classList.add('reset'); setTimeout(()=>location.reload(), 50)">↻ replay</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment