This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import the needed credential and management objects from the libraries. | |
from azure.identity import AzureCliCredential | |
from azure.mgmt.resource import ResourceManagementClient | |
from azure.mgmt.network import NetworkManagementClient | |
from azure.mgmt.compute import ComputeManagementClient | |
from azure.mgmt.compute.models import OrchestrationMode | |
import os | |
print(f"Provisioning a virtual machine scale set...some operations might take a minute or two.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
package_upgrade: true | |
packages: | |
- nginx | |
write_files: | |
- path: /var/www/html/index.html | |
content: | | |
<!DOCTYPE html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.4' | |
services: | |
yarpreverseproxy: | |
image: vmssapplicationhealth.azurecr.io/yarpreverseproxy:ds1 | |
container_name: yarpreverseproxy | |
ports: | |
- 80:7176 | |
links: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
package_upgrade: true | |
packages: | |
- nginx | |
- nodejs | |
- npm | |
write_files: | |
- owner: www-data:www-data | |
path: /etc/nginx/sites-available/default | |
content: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$allInstances = Get-AzVmssVM -InstanceView -ResourceGroupName $rg -VMScaleSetName $vmssName | |
$unhealthyInstances = $allInstances | where {$_.InstanceView.VmHealth.Status.Code -eq "HealthState/unhealthy"} | |
Write-Output "Total instances: $($allInstances.Count)" | |
Write-Output "Unhealthy instances: $($unhealthyInstances.Count)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connect-AzAccount | |
$mysub = "my-subscription-name" | |
$rg = "my-resourcegroup-name" | |
$vmssname = "my-vmss-name" | |
Set-AzContext -Subscription $mysub | |
$vmssmodel = Get-AzVmss -ResourceGroupName $rg -VMScaleSetName $vmssname | |
Write-Output($vmssmodel.Id) | |
Write-Output("FD Count: " + $vmssmodel.PlatformFaultDomainCount) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Azure Metadata app | |
[Service] | |
ExecStart=/usr/bin/node /var/www/azuremetadata/app.js | |
#Restart=always | |
StandardOut=syslog | |
StandardError=Syslog | |
User=nobody | |
# Note Debian/Ubuntu uses 'nogroup', RHEL/Fedora uses 'nobody' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
location / { | |
proxy_pass http://localhost:3000; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection keep-alive; | |
proxy_set_header Host $host; | |
proxy_cache_bypass $http_upgrade; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
package_upgrade: true | |
packages: | |
- nginx | |
- nodejs | |
- npm | |
write_files: | |
- owner: www-data:www-data | |
path: /etc/nginx/sites-available/default | |
content: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express') | |
var app = express() | |
var os = require('os'); | |
app.get('/', function (req, res) { | |
const request = require('request'); | |
const options = { | |
url: 'http://169.254.169.254/metadata/instance?api-version=2019-03-11', | |
headers: { | |
'Metadata': 'true' |
NewerOlder