Access packer variables

Is there a way to access azure-arm packer variables Like Managed os disk ID, Resource Id of the VM being built etc…

My use case is, once the base image is built, I need to scan it using some 3rd party security scanner. This requires the os disk to be preserved. ( I can set this using, keep_os_disk = true). Once the scanning is completed, I need to delete this os disk.

How do I access this disk resource ID? (say from an jenkins pipeline)

Did you find a way to do this?

With the AWS-ebs provider the following variables are provided

BuildRegion - The region (for example eu-central-1) where Packer is building the AMI.
SourceAMI - The source AMI ID (for example ami-a2412fcd) used to build the AMI.
SourceAMICreationDate - The source AMI creation date (for example "2020-05-14T19:26:34.000Z").
SourceAMIName - The source AMI Name (for example ubuntu/images/ebs-ssd/ubuntu-xenial-16.04-amd64-server-20180306) used to build the AMI.
SourceAMIOwner - The source AMI owner ID.
SourceAMIOwnerName - The source AMI owner alias/name (for example amazon).

By contrast the Azure provider only shows 1 variable as being available.

SourceImageName - The full name of the source image used in the deployment. When using shared images the resulting name will point to the actual source used to create the said version. building the AMI.

You could set the information into a variable that is later inserted into the manifest as a custom object. I’m a little confused though. If you’re building up the template image with packer, couldn’t you just build up a test system, after the fact, and scan that system, then delete the test VM?