{"id":6337,"date":"2022-11-15T04:07:43","date_gmt":"2022-11-15T04:07:43","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=6337"},"modified":"2022-11-23T00:44:10","modified_gmt":"2022-11-23T00:44:10","slug":"auto-start-vm-function-azure","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/research\/auto-start-vm-function-azure","title":{"rendered":"Auto Start VM Function Azure"},"content":{"rendered":"\n\n<div class=\"wp-block-wab-pastacode\">\n\t<div class=\"code-embed-wrapper\"> <pre class=\"language-markup code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-markup code-embed-code\">&lt;p&gt;host.json&lt;\/p&gt;&lt;div&gt;&lt;pre&gt;\u00a0&lt;\/pre&gt;&lt;\/div&gt;&lt;div&gt;&lt;p&gt;[pastacode lang=&quot;markdown&quot; manual=&quot;{<br\/><br\/>&quot;version&quot;: &quot;2.0&quot;,<br\/><br\/>&quot;managedDependency&quot;: {<br\/><br\/>&quot;Enabled&quot;: true<br\/><br\/>},<br\/><br\/>&quot;extensionBundle&quot;: {<br\/><br\/>&quot;id&quot;: &quot;Microsoft.Azure.Functions.ExtensionBundle&quot;,<br\/><br\/>&quot;version&quot;: &quot;[3.*, 4.0.0)&quot;<br\/><br\/>},<br\/><br\/>&quot;functionTimeout&quot;: &quot;00:10:00&quot;<br\/><br\/>}&quot; message=&quot;&quot; highlight=&quot;&quot; provider=&quot;manual&quot;\/]&lt;\/p&gt;&lt;\/div&gt;&lt;div&gt;Requirments.json&lt;\/div&gt;&lt;div&gt;\u00a0&lt;\/div&gt;&lt;div&gt;&lt;p&gt;[pastacode lang=&quot;markdown&quot; manual=&quot;# This file enables modules to be automatically managed by the Functions service.<br\/># See https:\/\/aka.ms\/functionsmanageddependency for additional information.<br\/>#<br\/>@{<br\/># For latest supported version, go to &#039;https:\/\/www.powershellgallery.com\/packages\/Az&#039;.<br\/># To use the Az module in your function app, please uncomment the line below.<br\/>&#039;Az&#039; = &#039;9.*&#039;<br\/>}&quot; message=&quot;&quot; highlight=&quot;&quot; provider=&quot;manual&quot;\/]&lt;\/p&gt;&lt;\/div&gt;&lt;p&gt;run.ps1 ( Does not work with multiple VM&#039;s )\u00a0&lt;\/p&gt;&lt;p&gt;[pastacode lang=&quot;powershell&quot; manual=&quot;# Input bindings are passed in via param block.<br\/>param($Timer)<br\/><br\/>$subscriptionId = &quot;xxxxxxxxxxxxxx&quot;<br\/>$tenantId = &quot;xxxxxxxxxxxxxx&quot;<br\/>$rsgName = &quot;xxxxxxxxxxxxxx&quot;<br\/>$vmName = &quot;xxxxxxxxxxxxxx&quot;<br\/><br\/>Select-AzSubscription -SubscriptionID $subscriptionId -TenantID $tenantId\\<br\/>Write-Warning &quot;Starting $vmName&quot;<br\/>Start-AzVM -ResourceGroupName $rsgName -Name $vmName&quot; message=&quot;&quot; highlight=&quot;&quot; provider=&quot;manual&quot;\/]&lt;\/p&gt;<\/code><\/pre> <div class=\"code-embed-infos\"> <\/div> <\/div><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[4072,1464,4073],"class_list":["post-6337","post","type-post","status-publish","format-standard","hentry","category-research","tag-autostart","tag-azure","tag-function"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/6337","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=6337"}],"version-history":[{"count":2,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/6337\/revisions"}],"predecessor-version":[{"id":6363,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/6337\/revisions\/6363"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=6337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=6337"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=6337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}