Giter Site home page Giter Site logo

mspnp / template-building-blocks Goto Github PK

View Code? Open in Web Editor NEW
327.0 73.0 125.0 4.07 MB

A tool for deploying Azure infrastructure based on proven practices. Azure building blocks take advantage of the Azure CLI and Azure Resource Manager templates to provision collections of resources as logical units with production-ready settings.

Home Page: https://www.npmjs.com/package/@mspnp/azure-building-blocks

License: Other

JavaScript 98.98% PowerShell 0.98% Shell 0.04%
azure resource-manager infrastructure deployment azure-resources vms vnet

template-building-blocks's Introduction

Azure Building Blocks       Azure Building Blocks

Azure Building Blocks: Simplifying Resource Deployment

Build status npm version

Important: The Azure Building Blocks project will not be undergoing further development. For advanced deployment template capabilities refer to Bicep, Azure Resource Manager template specs and the Azure Resource Manager template documentation. New development should not leverage Azure Building Blocks.

Note: Version 2.1.1 of Azure Building Blocks introduced breaking changes to versions earlier than 2.0.4. Versions earlier than 2.0.4 will no longer function. Please upgrade to version 2.0.4 or greater to continue using Azure Building Blocks.

The Azure Building Blocks project is a command line tool and set of Azure Resource Manager templates designed to simplify deployment of Azure resources. Users author a set of simplified parameters to specify settings for Azure resources, and the command line tool merges these parameters with best practice defaults to produce a set of final parameter files that can be deployed with the Azure Resource Manager templates.

Getting Started

Install the Azure Building Blocks using npm:

npm install -g @mspnp/azure-building-blocks

Verify the version of azure building blocks you are running using the command below. Make sure you are running version 2.0.4 or later.

azbb -V

Then, author an Azure Building Blocks parameter file and run the azbb command line tool.

Documentation

Full documentation for the command line tool and parameter file schema is available on the Wiki.

Examples

Azure Building Blocks parameters to deploy three identical VMs:

"type": "VirtualMachine",
"settings": {
    "vmCount": 3,
    "osType": "windows",
    "namePrefix": "test",
    "adminPassword": "testPassw0rd!23",
    "nics": [{"subnetName": "web"}],
    "virtualNetwork": {"name": "ra-vnet"}
}

The command line tool merges best practice defaults to the parameters as follows:

  • Enables diagnostics on all VMs
  • Deploys the VMs in an availability set
  • All VM disks are managed
  • OS is latest Windows Server 2016 image
  • Public IP created for each VM

To add a scaleset with three identical VMs:

"type": "VirtualMachine",
"settings": {
    "vmCount": 3,
    "osType": "windows",
    "namePrefix": "test",
    "adminPassword": "testPassw0rd!23",
    "nics": [{
        "subnetName": "web",
        "isPublic": false
        }],
    "virtualNetwork": {"name": "ra-vnet"},
    "scaleSetSettings": { }
}

Version history

The list below shows changes introduced with the latest versions.

2.0.4

  • Fixed minor bugs
  • Introduced a more rigorous versioning scheme

2.1.1

  • Introduced breaking changes to versions less than 2.0.4
  • Added standalone load balancer building block
  • Added standalone application gateway building block
  • Changes to VM building block to allow use of pre-existing load balancer and application gateway
  • Added support for 'single-step' disk encryption to VM building block

2.1.2

  • Fixed bug on internal load balancer
  • Added support for 'custom data' to VM building block

2.2.0

  • Added support for Availability Zones and Standard SKU for Load Balancers, Application Gateways, and Public IP Addresses
  • Added support for Availability Zones for virtual machines
  • Added deployment script generation
  • Added NodeJS 10.16.2+ requirement

2.2.1

  • Added missing subscription parameter

2.2.2

  • Fixed AZ CLI parameter issues

2.2.3

  • Fixed Azure Cloud Shell incompatibility

2.2.4

  • Added lifecycle warnings

License

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

template-building-blocks's People

Contributors

adamboeglin avatar alexbuckgit avatar atoakley avatar bennage avatar dependabot[bot] avatar hallihan avatar hanzzhang avatar jocontr avatar luisgmsft avatar niklasskoldmark avatar petertaylor9999 avatar rohitsharma-pnp avatar telmosampaio avatar woodp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

template-building-blocks's Issues

Parameterization of certain things

More of a feature request I believe. What is the recommended way of passing variables to azbb?

Use case: add AZBB as part of VS release pipeline which takes in something like -params:adminPassword=abc123 and passes it to arm template as a parameter for what might be vm password. Similar to how $AUTHENTICATION$ is done in src.

So, something like:

             {
                    "type": "VirtualMachine",
                    "settings": {
                        "vmCount": 1,
                        "osType": "windows",
                        "namePrefix": "jb",
                        "adminPassword": "{$adminPassword}",
                        "nics": [
                            {
                                "subnetName": "default",
                                "isPublic": true
                            }
                        ],
                        "virtualNetwork": {
                            "name": "simple-vnet"
                        }
                    }
                }

which could translate to the following when run as
azbb -s "786d6510-8f1e-4ae7-b55b-5178716e6ac8" -g "jjtest707" -l westus -p adminPassword=abc123

				"virtualMachines": [{
					"properties": {
						"hardwareProfile": {
							"vmSize": "Standard_DS2_v2"
						},
						"osProfile": {
							"adminUsername": "adminUser",
							"secrets": [],
							"adminPassword": "abc123",
							"windowsConfiguration": {
								"provisionVmAgent": true
							},
							"computerName": "jb-vm1"
						},
						"availabilitySet": null
					},
					"name": "jb-vm1",
					"extensions": [],
					"resourceGroupName": "jjtest707",
					"subscriptionId": "786d6510-8f1e-4ae7-b55b-5178716e6ac8",
					"location": "westus",
				}]

Scenarios Multi-Tier has bad fileUri reference

The file "extension-complete-ad1.json" has a broken link to a shared script repository that looks like it has moved.

fileUris": [
"https://raw.githubusercontent.com/mspnp/reference-architectures/master/virtual-machines/n-tier-windows/extensions/adds-forest.ps1"

Connection.md in wiki is missing some required properties for localNetworkGateway

GitHub doesn't seem to allow pull requests for wikis, otherwise, I would have put one in for this, but may I suggest a few edits to the localNetworkGateway object in Connection.md?

  - **localNetworkGateway**  
  _Object. Required when connectionType is_ `IPsec`. 
  The local network gateway to use with this connection. This resource reference object has the following properties:  
    - **name**  
    _String. Required._  
    The name of the local network gateway.
    - **ipAddress**
    _String. Required._
    The publicly addressable IP of the local network gateway.
    - **addressPrefixes**
    _Array of strings in CIDR format. Required._
    Specifies the CIDR address ranges whose traffic should be sent to the local network gateway.    
    - **subscriptionId**  
    _String in GUID format. Optional._  
    Specifies the ID of the Azure subscription that contains the local network gateway.  
    - **resourceGroupName**  
    _String. Optional._  
    Specifies the name of the resource group that contains the local network gateway.

Summary

  • Removed the word "existing" from the localNetworkGateway object description. This originally lead me to believe I had to create a local network gateway outside of Building Blocks, as there is no dedicated "block" for it. However, I have tested that if the local network gateway does not exist then it gets created during the deployment, so it does not need to exist prior to the deployment.
  • Added ipAddress and addressPrefixes properties. These seem to be required but absent from the wiki page, as I got validation failures when they were not included.

Tutorial 1 deploy a simple VNet

Hi,

The URL in "Move on to the second part of the tutorial to learn how to deploy two VNets and connect them using VNet peering." at "Next Steps" section is broken.

unable to run: scenarios/lb/load-balancer-internal.json

Trying to run:

https://github.com/mspnp/template-building-blocks/blob/master/scenarios/lb/load-balancer-internal.json

Getting the error " error: [{"name":"","message":"Array cannot be empty"}]"

% node --version
v8.9.3
% node node_modules/.bin/azbb --version
2.1.1
%  node debug node_modules/.bin/azbb -s [SUBSCRIPTION]  -l [LOCATION] -g [RESOURCE_GROUP] -p load-balancer-internal.json 

break in node_modules/@mspnp/azure-building-blocks/src/index.js:501
 499     }
 500
>501     let results = _.map(buildingBlockParameters, (value, index) => {
 502         let buildingBlockType = value.type;
 503         let buildingBlock = _.find(buildingBlocks, (value) => {
break in node_modules/@mspnp/azure-building-blocks/src/index.js:606
 604     }
 605 } catch (e) {
>606     console.error();
 607     console.error(`  error: ${e.message}`);
 608     console.error();
debug>

debug>
<   error: [{"name":"","message":"Array cannot be empty"}]
break in node_modules/@mspnp/azure-building-blocks/src/index.js:607

Deploying a machine from Marketplace

Im trying to deploy a VM using the following settings in parameter file:

 "size":"Standard_D3_v2",
        "osType": "linux",
        "imageReference":{
            "publisher":"paloaltonetworks",
            "offer":"vmseries1",
            "sku":"byol",
            "version":"latest"
        },
        "storageAccounts":{
            "skuType": "Standard_LRS"
        }

and it fails with

"Creating a virtual machine from Marketplace image requires Plan information in the request. OS disk name is 'zzz-vm1-os'

Any idea what am I missing there?

Deploying VM-Simple.json fails

https://github.com/mspnp/template-building-blocks/blob/master/scenarios/vm/vm-simple.json

I have the file local, and from PowerShell I run this command:
azbb -g RG-azbb -s xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -l eastus -p .\vm-simple.json --deploy

(Where xxx's are obviously my proper subscription ID)

The RG is created, as are the Public IP and Storage Account, but I get four deployment errors such as this:

{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.","details":[{"code":"BadRequest","message":"{\r\n "error": {\r\n "code": "InvalidResourceReference",\r\n "message": "Resource /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/RG-azbb2/providers/Microsoft.Network/virtualNetworks/msft-hub-vnet/subnets/mgmt referenced by resource /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/RG-azbb2/providers/Microsoft.Network/networkInterfaces/jb-vm1-nic1 was not found. Please make sure that the referenced resource exists, and that both resources are in the same region.",\r\n "details": []\r\n }\r\n}"}]}

Should I not be attempting to deploy this VM-Simple.json directly?

Update wiki docs

Working through the example on https://github.com/mspnp/template-building-blocks/wiki/Use-Template-Building-Blocks-version-2-Command-Line and I came across what looks like an outdated command. The example has:

node index.js -b vnet -g testRG -s xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -l westus -p .\spec\parameters\vnet-parameters.json -o test.json --deploy

but I believe it should be:

node index.js -g testRG -s xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -l westus -p ./spec/Parameters/vnet-parameters.json -o test.json --deploy

Notice that the -b flag is removed and that the path to the parameters file has an uppercase "P" for the parameters directory. Otherwise it breaks on linux :).

installation failure

Hello,
My OS is Win 7 Pro SP1 (x64).
I installed azure-cli-2.0.31 and node-v8.11.1-x64.
when I start the installation of AZURE Building Blocks with this command npm install -g @mspnp/azure-building-blocks I receive this error:


0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli '@mspnp/azure-building-blocks' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 372ceace7bda334a
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for @mspnp/azure-building-blocks@latest request to https://registry.npmjs.org/@mspnp%2fazure-building-blocks failed, reason: connect EACCES 151.101.120.162:443
8 verbose type system
9 verbose stack FetchError: request to https://registry.npmjs.org/@mspnp%2fazure-building-blocks failed, reason: connect EACCES 151.101.120.162:443
9 verbose stack at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\index.js:68:14)
9 verbose stack at emitOne (events.js:116:13)
9 verbose stack at ClientRequest.emit (events.js:211:7)
9 verbose stack at TLSSocket.socketErrorListener (_http_client.js:387:9)
9 verbose stack at emitOne (events.js:116:13)
9 verbose stack at TLSSocket.emit (events.js:211:7)
9 verbose stack at emitErrorNT (internal/streams/destroy.js:64:8)
9 verbose stack at _combinedTickCallback (internal/process/next_tick.js:138:11)
9 verbose stack at process._tickCallback (internal/process/next_tick.js:180:9)
10 verbose cwd C:\windows\system32
11 verbose Windows_NT 6.1.7601
12 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "@mspnp/azure-building-blocks"
13 verbose node v8.11.1
14 verbose npm v5.6.0
15 error code EACCES
16 error errno EACCES
17 error FetchError: request to https://registry.npmjs.org/@mspnp%2fazure-building-blocks failed, reason: connect EACCES 151.101.120.162:443
17 error at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\index.js:68:14)
17 error at emitOne (events.js:116:13)
17 error at ClientRequest.emit (events.js:211:7)
17 error at TLSSocket.socketErrorListener (_http_client.js:387:9)
17 error at emitOne (events.js:116:13)
17 error at TLSSocket.emit (events.js:211:7)
17 error at emitErrorNT (internal/streams/destroy.js:64:8)
17 error at _combinedTickCallback (internal/process/next_tick.js:138:11)
17 error at process._tickCallback (internal/process/next_tick.js:180:9)
17 error { FetchError: request to https://registry.npmjs.org/@mspnp%2fazure-building-blocks failed, reason: connect EACCES 151.101.120.162:443
17 error at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\index.js:68:14)
17 error at emitOne (events.js:116:13)
17 error at ClientRequest.emit (events.js:211:7)
17 error at TLSSocket.socketErrorListener (_http_client.js:387:9)
17 error at emitOne (events.js:116:13)
17 error at TLSSocket.emit (events.js:211:7)
17 error at emitErrorNT (internal/streams/destroy.js:64:8)
17 error at _combinedTickCallback (internal/process/next_tick.js:138:11)
17 error at process._tickCallback (internal/process/next_tick.js:180:9)
17 error message: 'request to https://registry.npmjs.org/@mspnp%2fazure-building-blocks failed, reason: connect EACCES 151.101.120.162:443',
17 error type: 'system',
17 error errno: 'EACCES',
17 error code: 'EACCES',
17 error stack: 'FetchError: request to https://registry.npmjs.org/@mspnp%2fazure-building-blocks failed, reason: connect EACCES 151.101.120.162:443\n at ClientRequest.req.on.err (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\index.js:68:14)\n at emitOne (events.js:116:13)\n at ClientRequest.emit (events.js:211:7)\n at TLSSocket.socketErrorListener (_http_client.js:387:9)\n at emitOne (events.js:116:13)\n at TLSSocket.emit (events.js:211:7)\n at emitErrorNT (internal/streams/destroy.js:64:8)\n at _combinedTickCallback (internal/process/next_tick.js:138:11)\n at process._tickCallback (internal/process/next_tick.js:180:9)' }
18 error Please try running this command again as root/Administrator.
19 verbose exit [ 1, true ]


Using azbb from Azure Automation?

Hey there

I'd love to be able to use Azure Building Blocks from within Azure Automation, I just can't figure out how.

Is it at all possible? If so what needs to be done? And if not, are you considering adding azbb to Azure Automation?

Thanks for this interesting and useful work

Michael

Is there a way to not have to list VM names in the VirtualMachineExtension vms array?

When creating VMs that need VirtualMachineExtension(s), it looks like you have to explicitly list the names of VMs created in prior VirtualMachine sections (blocks). For example I have

{
  "type": "VirtualMachine",
  "settings": {
      "namePrefix": "haproxy",
      "size": "Standard_D2s_v3",
      "vmCount": 2,
      ...
}

For VirtualMachineExtension (unless I'm missing something) I needed to expand the VM names (i.e. there's no shorthand for all the VMs created in the block):

{
  "type": "VirtualMachineExtension",
  "settings": [
      {
          "vms": [
                "haproxy-vm1","haproxy-vm2"
          ],
      ....
}

Then if I needed to scale up the VM count and redeploy, I'd need to make two updates?

  1. Change the vmCount and
  2. Update the list of VM names

In the samples the two AD servers play different roles, so the extensions are different, so I understand why the VM names are explicit. However in this case the same extension with same parameters should be applied to all the VMs created within that VirtualMachine block.

I can see the benefit of having VirtualMachineExtension as a top-level section to apply across multiple groups of VMs. However it would seem helpful to either:

  • Allow reference to the namePrefix for a group of VMs created that expands to those VMs
  • Allow specifying VirtualMachineExtension within the VM definition (similar to loadBalancerSettings) to have the VirtualMachineExtension apply to all of the VMs created from that definition.

Getting "error: Unexpected token I in JSON at position 0" when executing azbb from MacOS

hey guys,

When trying to deploy resources via azbb from a MacOS (Sierra 10.12.6), I'm getting the following error:

`azbb --location westus --resource-group rg-azbb --parameters-file deploy-vnet.json

"error: Unexpected token I in JSON at position 0"`

It looks like the JSON file is invalid, even though the same JSON file works well on Windows.

This is the JSON file I tried:

{
    "$schema": "https://raw.githubusercontent.com/mspnp/template-building-blocks/spikes/spikes/nodejs-spike/schemas/buildingBlocks.json",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "buildingBlocks": {
            "value": [{
                "type": "VirtualNetwork",
                "settings": [{
                    "name": "virtual-network-1",
                    "addressPrefixes": ["10.0.0.0/16"],
                    "subnets": [{
                            "name": "subnet-1",
                            "addressPrefix": "10.0.1.0/24"
                        },
                        {
                            "name": "subnet-2",
                            "addressPrefix": "10.0.2.0/24"
                        }
                    ]
                }]
            }]
        }
    }
}

Thanks,
--pr

Cannot install AZBB

Hi,

I'm trying to install the Azbb, but I receive an error message
After entering the command npm install -g @mspnp/azure-building-blocks I receive the following output:

image

I'm able to install any other npm package, so I don't understand why I cannot install AZBB

problem with intrinsic functions in the keyvault

The below fails as the [concat(uniquestring(subscription().id), 'secrets'] is taken as string

                   "adminPassword": {
                        "reference": {
                            "keyVault": {
                                "name": "[concat(uniquestring(subscription().id), 'secrets']",
                                "resourceGroupName": "keyvault"
                            },
                            "secretName": "kvPassword"
                        }
                    },

Enhancement: multiple parameters files

Hey all, first off this is a great tool, thanks for putting it together.

Would it make sense to support multiple parameters files that can then be combined into a single file? The use case is: people want to create a JSON file per NSG (or some other type of resource) and then have those files all squashed into a single JSON file.

The idea is that it might be easier to manage if you had a single NSG per file instead of potentially having 20+ NSGs in one file.

Thoughts?

Issue with running azbb

Hi,

On Ubuntu 16.04.4 LTS I'm having difficulty running azbb. I installed npm and azbb the following way:

sudo apt-get install npm
sudo npm install -g @mspnp/azure-building-blocks

When I run azbb I get the following:

tijmen@dash:~/Projects/reference-architectures/hybrid-networking/hub-spoke$ azbb -V
/usr/local/lib/node_modules/@mspnp/azure-building-blocks/src/index.js:45
let parseParameterFile = ({parameterFile}) => {
                          ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3

npm version = npm 3.5.2

Kind regards,

Tijmen

Enhancement: virtualMachineSettings: customData

Does the template support "customData" for linux VMs?

Trying the following:

{
              "type": "VirtualMachine",
              "settings": {
                "vmCount": 1,
                "namePrefix": "linux",
                "size": "Standard_DS2_v2",
                "adminUsername": "chen",
                "adminPassword": "...",
                "customData":"foobar",

Getting:

                "osProfile": {
                  "adminUsername": "chen",
                  "secrets": [],
                  "adminPassword": "$AUTHENTICATION$",
                  "linuxConfiguration": null,
                  "computerName": "linux-vm1"
                },

Expecting:

                "osProfile": {
                  "adminUsername": "chen",
                  "secrets": [],
                  "adminPassword": "$AUTHENTICATION$",
                  "customData": "foobar",
                  "linuxConfiguration": null,
                  "computerName": "linux-vm1"
                },

Thank you.

Availability Set not created if less than 2 VMs are created by multi-vm-n-nic-m-storage

If you create a VM using this building block and only specify that one VM be created then an Availabilty set is not created even if you specify "No" for "useExistingAvailabilitySet". Is that by design? I know that an availability set with only one VM doesn't do anything. But the current behavior precludes creating one VM with an availability set and then creating a second one later and adding it to the existing availability set, because its not there.

Deployment failed

Hi, I'm trying to deploy simple BB, like vnet only. But getting this error:
Deployment template validation failed: 'The template resource '[concat(parameters('deploymentContext').parentTemplateUni
queString, '-vnet-', copyIndex(), '-', variables('templateUniqueString'))]' at line '30' and column '6' is invalid. The
api-version '2016-09-01' used to deploy the template does not support 'ResourceGroup' property. Please use api-version '
2017-05-10' or later to deploy the template. Please see https://aka.ms/arm-template/#resources for usage details.'.

name vs computerName in VM building block

The suffix -vmX is valid for a resource name in Azure, but not needed for the hostname in a computer. Please change remove -vm as suffix for the computerName, and simply use prefixX.

Installing azbb without ever having logged into azure results in incorrect error message

Steps to repro:

Environment: az installed, npm installed, node installed

  1. Open new cmd.exe command prompt.
  2. Create new directory. Navigate to new directory.
  3. Install azbb ('npm install....')
  4. Attempt to deploy ('azbb -p .json...)

Result:

  error: error executing az
  status: 1
  arguments: group exists --name testRG

Note that testRG does not exist as a resource group in Azure.
Logging in via az login fixes the issue.

New-AzureRmResourceGroup fails with V2 template building blocks

I am testing using simple vnet scenarios as shown in the example scenarios. New-AzureRmResourceGroup fails with V2 template building blocks. This code works using the V1 templates and associated V1 parameter files.

the following works:
azbb -g TestResourceGroup -s aaa-aaaa-aaa 5 -l westeurope --deploy -p .\virtualNetworkV2-mod.parameters.json

New-AzureRmResourceGroup with the same template fails and requests deploymentcontext object and virtualnetworks object.
$resgroup = New-AzureRmResourceGroup -Name TestResourceGroup -Location westeurope
New-AzureRmResourceGroupDeployment -Name Deploy-SampleVnetV2 -ResourceGroupName $resgroup -Mode Incremental -DeploymentDebugLogLevel All -TemplateParameterFile D:\temp\virtualNetworkV2-mod.parameters.json
-TemplateUri https://raw.githubusercontent.com/mspnp/template-building-blocks/master/templates/buildingBlocks/virtualNetworks/virtualNetworks.json -Verbose -WhatIf

Please could someone show what is needed to operate the templates using powershell?
Thanks

Support for YAML

Hi,

I recently came across the Building Blocks and have found the idea really useful (I have not made any production use of them yet). But as always, I continue to struggle with JSON. I guess my brain is not cut out for so many curly and square brackets.

I really think YAML support would be a great addition to the Building Blocks. I have already implemented (about 5 new lines of code) and tested it in my own fork of the project, and find it really nice to work with.

Do you think this would be a good candidate for a Pull Request ? This is the first time I suggest to submit one, so please advise.

Thanks
Vincent

VM deployment fails when adminPassword is keyVaultReference

This example https://github.com/mspnp/template-building-blocks/blob/master/scenarios/vm/vm-win-keyvault.json fails with the error below

The error seems to be because location, subscribtionId and resourceGroup are added as resource properties of the KeyVaultReference and fails schema validation.

Deployment failed. Correlation ID: a72a1cb4-c02e-4727-a24a-b6864acc4d8c. {
"status": "Failed",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource operation completed with terminal provisioning state 'Failed'.",
"details": [
{
"code": "DeploymentFailed",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.",
"details": [
{
"code": "BadRequest",
"message": "{\r\n "error": {\r\n "code": "InvalidRequestContent",\r\n "message": "The request content was invalid and could not be deserialized: 'Could not find member 'resourceGroupName' on object of type 'KeyVaultReference'. Path 'properties.parameters.authentication.reference.keyVault.resourceGroupName', line 1, position 1691.'."\r\n }\r\n}"
}
]
}
]
}
}

update building blocks to support sovereign clouds

It would great if you could improve these templates so those who use AzureChinaCloud, AzureUSGovernment, and AzureGermanCloud can use them as well.

I forked and made some brute force changes to quickly get the n-tier reference architecture working in Azure Government:
https://github.com/devkeydet/reference-architectures
https://github.com/devkeydet/template-building-blocks

Most of the incompatibilities include hard coded storage endpoints in templates. Guidance on fixing this is available in at:
https://docs.microsoft.com/en-us/azure/azure-government/documentation-government-manage-marketplace-partners

Another major incompatibility is using fixed values for VM sizes. For example "Standard_DS1_v2" is not available in all sovereign cloud regions. Parameterizing these values would allow the user to make the choice at deployment time.

VNet peering across subscriptions

I'm attempting to create VNet peerings in a hub-and-spoke topology, with different Azure subscriptions in the same AAD tenant. VNets are in the same Azure region (eastus). Trying to create the peerings results in the following error, and no output files are generated:

$ azbb -s xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -g rgname -l eastus -p paramfile.json --deploy

  error: [{"result":false,"message":"Virtual network and peering location cannot be different"}]`

The parameter file section is set up like this (spoke config, redacted):

                            "virtualNetworkPeerings": [
                                {
                                    "name": "hub-peering",
                                    "remoteVirtualNetwork": [
                                        {
                                            "name": "hubvnetname",
                                            "subscriptionId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
                                            "resourceGroupName": "rgname"
                                        }
                                    ],
                                    "allowForwardedTraffic": true,
                                    "allowGatewayTransit": false,
                                    "useRemoteGateways": false
                                }
                            ],

Creating the peering with the exact same settings in the Azure Portal succeeds.

Tutorial 5 fails.

When trying to deploy tutorial 5 after previously deployed tutorial 4 it fails with the following error: Changing property 'imageReference' is not allowed..
tutorial-5.json contains the following lines in the AD VMs section, which makes it fail:
"imageReference": { "publisher": "MicrosoftWindowsServer", "offer": "WindowsServer", "sku": "2012-R2-Datacenter", "version": "latest" },

If removed it works as expected.

"sudo npm pack" fails in template-building-blocks/src on Ubuntu

I'm following the Linux install steps on Ubuntu, and it fails in both an Azure VM and in bash on Windows.

Screen output here, and npm-debug.log(.txt) attached:

richeney@azbb:~/template-building-blocks/src$ sudo npm pack
npm ERR! addLocal Could not install /home/richeney/template-building-blocks/src
npm ERR! Linux 4.4.0-92-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "pack"
npm ERR! node v6.11.3
npm ERR! npm v3.10.10

npm ERR! code EISDIR
npm ERR! errno -21
npm-debug.log.txt

npm ERR! syscall read

npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.

npm ERR! Please include the following file with any support request:
npm ERR! /home/richeney/template-building-blocks/src/npm-debug.log

NSG issue

NSG rule priority does not seem to work.

Python vs Node

As much as I appreciate the ease of use of azbb, I have to ask for a Python equivalent -- many organisations simply refuse to use Node as part of their sysadmin toolchains, given its brittleness and lack of fit with Python-based tooling and libraries.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.