https://github.com/cloudyr/AzureVMmetadata
R interface to VM instance metadata. Submit issues and PRs at https://github.com/Azure/AzureVMmetadata.
https://github.com/cloudyr/AzureVMmetadata
Last synced: 4 months ago
JSON representation
R interface to VM instance metadata. Submit issues and PRs at https://github.com/Azure/AzureVMmetadata.
- Host: GitHub
- URL: https://github.com/cloudyr/AzureVMmetadata
- Owner: cloudyr
- License: other
- Created: 2019-08-03T07:37:18.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-12T18:54:13.000Z (over 4 years ago)
- Last Synced: 2024-08-13T07:13:23.764Z (8 months ago)
- Language: R
- Size: 98.6 KB
- Stars: 1
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- jimsghstars - cloudyr/AzureVMmetadata - R interface to VM instance metadata. Submit issues and PRs at https://github.com/Azure/AzureVMmetadata. (R)
README
# AzureVMmetadata
[](https://cran.r-project.org/package=AzureVMmetadata)

A simple package to access the [instance metadata service](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service) in an Azure virtual machine.
The primary repo for this package is at https://github.com/Azure/AzureVMmetadata; please submit issues and PRs there. It is also mirrored at the Cloudyr org at https://github.com/cloudyr/AzureVMmetadata. You can install the development version of the package from GitHub:
```r
devtools::install_github("Azure/AzureVMmetadata")
```## Accessing metadata
AzureVMmetadata exposes three environments that contain the metadata for the VM:
- `instance`: The instance metadata, containing 2 components: `compute` and `network`
- `attested`: The attested metadata, containing the base64-encoded PKCS-7 certificate for the VM
- `events`: The scheduled events for the VMThe first two are automatically populated when the package is loaded; you can also manually update them with the `update_instance_metadata()` and `update_attested_metadata()` functions. `events` is not populated at package startup (it causes the event scheduler service to be started on the VM, which can take up to several minutes), but you can update it manually with `update_scheduled_events()`.
```r
## these will only be meaningful when run in an Azure VM# all compute metadata
AzureVMmetadata::instance$compute# VM name and ID
AzureVMmetadata::instance$compute$name
AzureVMmetadata::instance$compute$vmId# VM resource details: subscription, resource group, ID
AzureVMmetadata::instance$compute$subscriptionId
AzureVMmetadata::instance$compute$resourceGroupName
AzureVMmetadata::instance$compute$resourceId# all network metadata
AzureVMmetadata::instance$network# IPv4 address details (1st network interface)
AzureVMmetadata::instance$network$interface[[1]]$ipv4# raw PKCS-7 certificate for the VM
AzureVMmetadata::attested$signature# certificate as an openssl::cert object
AzureVMmetadata::get_vm_cert()
```----