npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

az-deployment-denoise

v1.1.0

Published

Azure deployment what-if denoiser

Downloads

621

Readme

Azure deployment what-if denoiser

This tool helps reduce false positive predictions in the result of az deployment what-if (ARM, Bicep) by filtering out unnecessary changes.

False positive predictions contained in the result of az deployment what-if

As indicated in the initial part of the result, the response from Deployment - What-If API may contain false positive predictions.

Note: The result may contain false positive predictions (noise). You can help us improve the accuracy of the result by opening an issue here: https://aka.ms/WhatIfIssues

For instance, the what-if result with Bicep code below indicates changes every time, even when the resource has not changed.

param location string = resourceGroup().location
param functionAppName string
param appServicePlanName string

resource appServicePlan 'Microsoft.Web/serverfarms@2022-09-01' = {
  name: appServicePlanName
  location: location
  sku: {
    name: 'B1'
  }
  kind: 'FunctionApp'
}

resource functionApp 'Microsoft.Web/sites@2022-09-01' = {
  name: functionAppName
  location: location
  kind: 'functionapp'
  properties: {
    serverFarmId: appServicePlan.id
    siteConfig: {
      appSettings: [
        {
          name: 'FUNCTIONS_EXTENSION_VERSION'
          value: '~4'
        }
        {
          name: 'FUNCTIONS_WORKER_RUNTIME'
          value: 'node'
        }
      ]
    }
  }
}

The what-if execution is:

az deployment group what-if --template-file false-positive-example.bicep --name test-deployment --resource-group test-rg --parameters functionAppName=test-func-denoise appServicePlanName=test-plan

The result is:

Note: The result may contain false positive predictions (noise).
You can help us improve the accuracy of the result by opening an issue here: https://aka.ms/WhatIfIssues

Resource and property changes are indicated with these symbols:
  + Create
  ~ Modify
  = Nochange

The deployment will update the following scope:

Scope: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg

  ~ Microsoft.Web/sites/test-func-denoise [2022-09-01]
    + properties.siteConfig.localMySqlEnabled:   false
    + properties.siteConfig.netFrameworkVersion: "v4.6"

  = Microsoft.Web/serverfarms/test-plan [2022-09-01]

Resource changes: 1 to modify, 1 no change.

Changes (creation of properties.siteConfig.localMySqlEnabled and properties.siteConfig.netFrameworkVersion) are shown just after az deployment create.

How to use

Install from npm

npm install -g az-deployment-denoise
# or
yarn global add az-deployment-denoise

Define filtering rule

Define rules in az-deployment-denoise.json to filter changes. Alternatively, you can define rules using YAML in az-deployment-denoise.yml. To specify your own file name, use the -f option.

You can use the following conditions.

| Key | Meaning | Example | |:-------------------|:-------------------------------------------------------------------------------|:----------------------------------------| | resourceGroupName | resource group name | test-rg | | providerNamespace | provider namespace | Microsoft.Web | | resourceType | resource type | sites | | resourceName | resource name | test-func-denoise | | resourceNameRegex | resource name (regex) | ^[^-]+-func-denoise$ | | propertyChangeType | type of property change type (Create | Delete | Modify | Array | NoEffect) | Delete | | propertyPath | propety path joined with . | properties.siteConfig.localMySqlEnabled |

If you want to filter the resource /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/Microsoft.Web/sites/test-func-denoise, you can define a rule like below.

{
  "rules": [
    {
      "resourceName": "test-func-denoise"
    }
  ]
}

Or, you can filter the creation of properties.siteConfig.localMySqlEnabled in any Azure Functions resource with a rule like below.

{
  "rules": [
    {
      "providerNamespace": "Microsoft.Web",
      "resourceType": "sites",
      "propertyPath": "properties.siteConfig.localMySqlEnabled"
    }
  ]
}

Usage

Execute az deployment with --no-pretty-print and input its output to az-deployment-denoise.

az deployment group what-if --resource-group YOUR_RESOURCE_GROUP --template-file YOUR_TEMPLATE_FILE --no-pretty-print | az-deployment-denoise

You can show available options with --help.

az-deployment-denoise --help

Development

Install dependencies

npm install

Build and run

npm run build
npm start

# for debugging
npm run debug

Lint

npm run lint

# lint and fix
npm run lint:fix

Test

npm test

# for watching
npm run test:watch

# for debugging
npm run test:debug

Clean artifacts

npm run clean

License

MIT