Skip to content

create examples

Oliver Gaida edited this page Dec 16, 2020 · 1 revision

create Azure Subscriptions in USD

given a text file with

customer name
customer_domainname
subscription
customer2 name
customer2_domainname
subscription2
...

an erb template with the filename `nr.create.class_azure_subscription.erb``and content:

{
    "nr": {
        "name": "<%= name %>",
        "class": {
          "@id": "<%= class_id %>"
        },
        "description": "<%= desc %>"
    }
}

and then the following loop creates the create statements 6 is the number of tenants i have, u should change this.... Then just copy paste on the terminal...

seq 1 6| while read i; do sed -n "$(((i-1)*3+1)),$(((i)*3)) p" help | ruby -e 'a=STDIN.read.split(/\n/);puts "erb name=#{a[1]}_#{a[2]} class_id=1000923 desc=\"#{a[0]}\"  nr.create.class_azure_subscription.erb | rusdc create"'; done

Clone this wiki locally