# @azbake/arm-helper

> Helper class for installing ARM templates through Bake.

Latest version **0.1.112** (published 2024-07-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @azbake/arm-helper
pnpm add @azbake/arm-helper
yarn add @azbake/arm-helper
bun add @azbake/arm-helper
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.1.112 |
| Published | 2024-07-25 |
| First published | 2019-02-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 50.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | HCHB |
| Maintainers | pipelinehchb |

## Links

- npm: https://www.npmjs.com/package/@azbake/arm-helper
- Repository: https://github.com/HomecareHomebase/azure-bake
- Issues: https://github.com/HomecareHomebase/azure-bake/issues
- npm.io page: https://npm.io/package/@azbake/arm-helper

## Recent versions

- 0.1.112 (latest) — 2024-07-25
- 0.1.110 — 2023-02-02
- 0.1.109 — 2022-04-05
- 0.1.108 — 2022-04-05
- 0.1.107 — 2022-04-04
- 0.1.106 — 2022-03-28
- 0.1.105 — 2022-01-11
- 0.1.104 — 2020-10-16
- 0.1.103 — 2020-10-08
- 0.1.102 — 2020-07-21
- 0.1.101 — 2020-07-14
- 0.1.100 — 2020-06-18
- 0.1.99 — 2020-05-12
- 0.1.98 — 2020-04-22
- 0.1.97 — 2020-02-19
- … 28 more at https://npm.io/package/@azbake/arm-helper/versions

## README

## Changelogs
* [@azbake/arm-helper](./CHANGELOG.md)

## Overview

ARM Helper is a utility plugin for Bake that can be used by ingredients to easily deploy ARM templates.

## Usage

To use, install the utility as a dependency for your ingredient.

```bash
  npm i @azbake/arm-helper
```

## ARMHelper class

Class for deploying ARM templates and transforming bake parameters into ARM template parameters.

### Constructors

ARMHelper(context)

### Functions

|function|description|
|--------|-----------|
|DeployTemplate(deploymentName, template, params, resourceGroup)| Deploys the specified ARM template with the specified parameters.|
|BakeParamsToARMParams(deploymentName, params)| Converts bake parameters to the format expected by ARM for ARM parameters.|

### Constructor Details

#### ARMHelper(context)

```typescript
new ARMHelper(context)
```

##### Parameters
|parameter|type|required|description|
|---------|----|--------|-----------|
|``context``|DeploymentContext|yes|The current bake deployment context|

### Function Details

#### DeployTemplate(deploymentName, template, params, resourceGroup)

Deploys the specified ARM template with the specified parameters to the specified resourceGroup.  This is a long running function and should be used with the ``await`` operator.

```typescript
public async DeployTemplate(deploymentName, template, params, resourceGroup)
```

##### Parameters
|parameter|type|required|description|
|---------|----|--------|-----------|
|``deploymentName``|string|yes|Name of the deployment for Azure.|
|``template``|any|yes|JSON object representing the arm template|
|``params``|any|yes|JSON object representing parameters used in the ARM template|
|``resourceGroup``|string|yes|Name of the resource group the ARM template will deploy into|

##### Returns
``Promise<void>``

#### BakeParamsToARMParams(deploymentName, params)

Reads the Bake parameters and converts them into values acceptable for parameters of ARM templates.

```typescript
public BakeParamsToARMParams(deploymentName, params)
```

##### Parameters
|parameter|type|required|description|
|---------|----|--------|-----------|
|``deploymentName``|string|yes|Name of the azure deployment|
|``params``|``Map<string, BakeVariable>``|yes|The parameters passed into the ingredient|

##### Returns
``any``

JSON object of parameters to load into the ARM template during deployment.







## Example

```typescript
import { BaseIngredient, IngredientManager } from "@azbake/core"
import { ARMHelper } from "@azbake/arm-helper"
import arm from "./arm.json"

export class MyIngredient extends BaseIngredient {

  public async Execute(): Promise<void> {

    const util = IngredientManager.getIngredientFunction("coreutils", this._ctx)
    const helper = new ARMHelper(this._ctx)

    const parameters = await helper.BakeParamsToARMParamsAsync(this._name, this._ingredient.properties.parameters)

    await helper.DeployTemplate(this._name, arm, parameters, await util.resource_group())
  }
}

```

---
_Source: https://npm.io/package/@azbake/arm-helper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
