Answers: <p>Use the following configuration key:</p>
  <pre class="lang-json prettyprint-override"><code>.
  .
  &quot;temp_compute_name&quot;: &quot;&lt;desired_name&gt;&quot;,
  .
  .
  </code></pre>
  <p>Note: Try to keep name short.</p>
  
Answers: CC BY-SA 4.0
Answers: 2022-07-01T00:35:24.710Z
Answers: 2022-07-01T10:22:47.237Z
Answers: 2022-07-01T10:22:47.237Z
Answers: Vix
Body: <p>According to <a href="https://docs.microsoft.com/en-us/azure/virtual-machines/linux/image-builder" rel="nofollow noreferrer">this</a> manual one can build an image on Azure using Azure Image Builder. When running the first example, the following error is shown in the customization log:</p>
  <pre><code>PACKER ERR ==&gt; azure-arm: ERROR: -&gt; RequestDisallowedByPolicy :
  Resource '1f43d6s8hd4fr5e' was disallowed by policy
  &quot;Virtual Machine Naming Policy&quot;
  </code></pre>
  <p>The question is how to set the Virtual Machine image name using Azure Image Builder.</p>
  <p><strong>Attempts to solve the issue</strong></p>
  <ol>
  <li>Asked the team that is responsible for the policy to remove are change the <em>Virtual Machine Naming Policy</em></li>
  <li>Tried to change the VM image name by modifying some keys in the json file.</li>
  <li>Created the following GitHub <a href="https://github.com/Azure/azvmimagebuilder/issues/28" rel="nofollow noreferrer">issue</a>.</li>
  </ol>
  
Tags: <azure><packer><vm>
Title: How to set the Virtual Machine name using Azure Image Builder?
UserDisplayName: 030
ThreadText: # How to set the Virtual Machine name using Azure Image Builder?
  
  (Asked by: username_0 on 2022-03-11)
  
  According to [this](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/image-builder) manual one can build an image on Azure using Azure Image Builder. When running the first example, the following error is shown in the customization log:
  
  ```
  PACKER ERR ==> azure-arm: ERROR: -> RequestDisallowedByPolicy :
  Resource '1f43d6s8hd4fr5e' was disallowed by policy
  "Virtual Machine Naming Policy"
  
  ```
  
  The question is how to set the Virtual Machine image name using Azure Image Builder.
  
  **Attempts to solve the issue**
  
  1. Asked the team that is responsible for the policy to remove are change the *Virtual Machine Naming Policy*
  2. Tried to change the VM image name by modifying some keys in the json file.
  3. Created the following GitHub [issue](https://github.com/Azure/azvmimagebuilder/issues/28).
  
  **Tags:** azure, packer, vm
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-07-01. Score: 0
  
  Use the following configuration key:
  
  ```json
  .
  .
  "temp_compute_name": "<desired_name>",
  .
  .
  
  ```
  
  Note: Try to keep name short.
  
  
  ---
  
  