A sample that will allow you to posting events to metered billing API in a Managed Application from a VM. The VM is deployed into the managed resource group.
- Use the contents of the
/vm/arm
folder to create a ZIP file for your plan in Partner Center, or just use theapp.zip
file already in the repo. - Upload the ZIP file to the Technical Configuration page of the Azure Managed Application plan in Partner Center.
- Publish the plan. It will take some time for the plan to reach Preview stage.
- From Preview, purchase the plan.
- Do not purchase the plan from the same Azure Tenant as the one used to publish the plan. If you do so, the script referenced later will error.
- Use the
East US
region using this example to ensure support for the VM SKU specified in the ARM template.
- After deployment is complete, remote into the newly deployed VM.
- Open Internet Explorer (IE).
- After opening IE, set the custom security settings to allow downloads.
- Download this repository's code as a ZIP file from this URL.
- In PowerShell, navigate to the
/vm/ps
folder on the VM.- Run the command
notepad ./ps/RunIt.ps1
. - Open the RunIt file and see the arguments you need to pass to the Invoke-Meter function.
- Provide the correct values for the arguments.
- Run the command
Set-ExecutionPolicy Bypass
. - Run the command
./ps/RunIt.ps1
.
- Run the command
- The results of the call will be show at the bottom of the terminal window after the script runs.
- When the meter has been posted successfully it will show the output of the reply JSON at the bottom of the screen.
- If there is an error the meter did not get called or the meter is a duplicate of one sent earlier. The error message will indicate which.