Skip to content

Commit 8e61109

Browse files
authored
Merge pull request #85251 from tushar-bhargava-ms/master
IMDS: Added information about subscriptionId and tagsList fields.
2 parents b219905 + a4b3b59 commit 8e61109

File tree

2 files changed

+74
-20
lines changed

2 files changed

+74
-20
lines changed

articles/virtual-machines/linux/instance-metadata-service.md

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ The service is available in generally available Azure regions. Not all API versi
3535

3636
Regions | Availability? | Supported Versions
3737
-----------------------------------------------|-----------------------------------------------|-----------------
38-
[All Generally Available Global Azure Regions](https://azure.microsoft.com/regions/) | Generally Available | 2017-04-02, 2017-08-01, 2017-12-01, 2018-02-01, 2018-04-02, 2018-10-01, 2019-02-01, 2019-03-11
39-
[Azure Government](https://azure.microsoft.com/overview/clouds/government/) | Generally Available | 2017-04-02, 2017-08-01, 2017-12-01, 2018-02-01, 2018-04-02, 2018-10-01, 2019-02-01, 2019-03-11
40-
[Azure China](https://www.azure.cn/) | Generally Available | 2017-04-02, 2017-08-01, 2017-12-01, 2018-02-01, 2018-04-02, 2018-10-01, 2019-02-01, 2019-03-11
41-
[Azure Germany](https://azure.microsoft.com/overview/clouds/germany/) | Generally Available | 2017-04-02, 2017-08-01, 2017-12-01, 2018-02-01, 2018-04-02, 2018-10-01, 2019-02-01, 2019-03-11
38+
[All Generally Available Global Azure Regions](https://azure.microsoft.com/regions/) | Generally Available | 2017-04-02, 2017-08-01, 2017-12-01, 2018-02-01, 2018-04-02, 2018-10-01, 2019-02-01, 2019-03-11, 2019-04-30, 2019-06-01, 2019-06-04
39+
[Azure Government](https://azure.microsoft.com/overview/clouds/government/) | Generally Available | 2017-04-02, 2017-08-01, 2017-12-01, 2018-02-01, 2018-04-02, 2018-10-01, 2019-02-01, 2019-03-11, 2019-04-30
40+
[Azure China](https://www.azure.cn/) | Generally Available | 2017-04-02, 2017-08-01, 2017-12-01, 2018-02-01, 2018-04-02, 2018-10-01, 2019-02-01, 2019-03-11, 2019-04-30
41+
[Azure Germany](https://azure.microsoft.com/overview/clouds/germany/) | Generally Available | 2017-04-02, 2017-08-01, 2017-12-01, 2018-02-01, 2018-04-02, 2018-10-01, 2019-02-01, 2019-03-11, 2019-04-30
4242

4343
This table is updated when there are service updates and or new supported versions are available.
4444

@@ -372,6 +372,7 @@ resourceId | The [fully qualified](https://docs.microsoft.com/rest/api/resources
372372
sku | Specific SKU for the VM image | 2017-04-02
373373
subscriptionId | Azure subscription for the Virtual Machine | 2017-08-01
374374
tags | [Tags](../../azure-resource-manager/resource-group-using-tags.md) for your Virtual Machine | 2017-08-01
375+
tagsList | Tags formatted as a JSON array for easier programmatic parsing | 2019-06-04
375376
version | Version of the VM image | 2017-04-02
376377
vmId | [Unique identifier](https://azure.microsoft.com/blog/accessing-and-using-azure-vm-unique-id/) for the VM | 2017-04-02
377378
vmScaleSetName | [Virtual Machine ScaleSet Name](../../virtual-machine-scale-sets/virtual-machine-scale-sets-overview.md) of your virtual machine scale set | 2017-12-01
@@ -422,7 +423,7 @@ Nonce is an optional 10-digit string provided. Nonce can be used to track the re
422423
}
423424
```
424425
425-
> The signature blob is a [pkcs7](https://aka.ms/pkcs7) signed version of document. It contains the certificate used for signing along with the VM details like vmId, nonce, timeStamp for creation and expiry of the document and the plan information about the image. The plan information is only populated for Azure Market place images. The certificate can be extracted from the response and used to validate that the response is valid and is coming from Azure.
426+
> The signature blob is a [pkcs7](https://aka.ms/pkcs7) signed version of document. It contains the certificate used for signing along with the VM details like vmId, nonce, subscriptionId, timeStamp for creation and expiry of the document and the plan information about the image. The plan information is only populated for Azure Market place images. The certificate can be extracted from the response and used to validate that the response is valid and is coming from Azure.
426427
427428
#### Retrieving attested metadata in Windows Virtual Machine
428429
@@ -454,7 +455,7 @@ Nonce is an optional 10-digit string provided. Nonce can be used to track the re
454455
}
455456
```
456457
457-
> The signature blob is a [pkcs7](https://aka.ms/pkcs7) signed version of document. It contains the certificate used for signing along with the VM details like vmId, nonce, timeStamp for creation and expiry of the document and the plan information about the image. The plan information is only populated for Azure Market place images. The certificate can be extracted from the response and used to validate that the response is valid and is coming from Azure.
458+
> The signature blob is a [pkcs7](https://aka.ms/pkcs7) signed version of document. It contains the certificate used for signing along with the VM details like vmId, nonce, subscriptionId, timeStamp for creation and expiry of the document and the plan information about the image. The plan information is only populated for Azure Market place images. The certificate can be extracted from the response and used to validate that the response is valid and is coming from Azure.
458459
459460
460461
## Example scenarios for usage
@@ -565,8 +566,32 @@ curl -H Metadata:true "http://169.254.169.254/metadata/instance/compute/tags?api
565566
Department:IT;Environment:Test;Role:WebRole
566567
```
567568
568-
> [!NOTE]
569-
> The tags are semicolon separated. If a parser is written to programmatically extract the tags, the tag names and values shouldn't contain semicolons in order for the parser to work correctly.
569+
The `tags` field is a string with the tags delimited by semicolons. This can be a problem if semicolons are used in the tags themselves. If a parser is written to programmatically extract the tags, you should rely on the `tagsList` field which is a JSON array with no delimiters, and consequently, easier to parse.
570+
571+
**Request**
572+
573+
```bash
574+
curl -H Metadata:true "http://169.254.169.254/metadata/instance/compute/tagsList?api-version=2019-06-04&format=text"
575+
```
576+
577+
**Response**
578+
579+
```json
580+
[
581+
{
582+
"name": "Department",
583+
"value": "IT"
584+
},
585+
{
586+
"name": "Environment",
587+
"value": "Test"
588+
},
589+
{
590+
"name": "Role",
591+
"value": "WebRole"
592+
}
593+
]
594+
```
570595
571596
### Validating that the VM is running in Azure
572597
@@ -609,7 +634,8 @@ Verification successful
609634
"createdOn":"11/28/18 00:16:17 -0000",
610635
"expiresOn":"11/28/18 06:16:17 -0000"
611636
},
612-
"vmId":"d3e0e374-fda6-4649-bbc9-7f20dc379f34"
637+
"vmId":"d3e0e374-fda6-4649-bbc9-7f20dc379f34",
638+
"subscriptionId": "xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx"
613639
}
614640
```
615641
@@ -620,10 +646,11 @@ plan | [Plan](https://docs.microsoft.com/rest/api/compute/virtualmachines/create
620646
timestamp/createdOn | The timestamp at which the first signed document was created
621647
timestamp/expiresOn | The timestamp at which the signed document expires
622648
vmId | [Unique identifier](https://azure.microsoft.com/blog/accessing-and-using-azure-vm-unique-id/) for the VM
649+
subscriptionId | Azure subscription for the Virtual Machine, introduced in `2019-04-30`
623650
624651
#### Verifying the signature
625652
626-
Once you get the signature above, you can verify that the signature is from Microsoft. Also you can verify the intermediate certificate and the certificate chain.
653+
Once you get the signature above, you can verify that the signature is from Microsoft. Also you can verify the intermediate certificate and the certificate chain. Lastly, you can verify the subscription ID is correct.
627654
628655
> [!NOTE]
629656
> The certificate for Public cloud and sovereign cloud will be different.

articles/virtual-machines/windows/instance-metadata-service.md

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ The service is available in generally available Azure regions. Not all API versi
3535

3636
Regions | Availability? | Supported Versions
3737
-----------------------------------------------|-----------------------------------------------|-----------------
38-
[All Generally Available Global Azure Regions](https://azure.microsoft.com/regions/) | Generally Available | 2017-04-02, 2017-08-01, 2017-12-01, 2018-02-01, 2018-04-02, 2018-10-01, 2019-02-01, 2019-03-11
39-
[Azure Government](https://azure.microsoft.com/overview/clouds/government/) | Generally Available | 2017-04-02, 2017-08-01, 2017-12-01, 2018-02-01, 2018-04-02, 2018-10-01, 2019-02-01, 2019-03-11
40-
[Azure China](https://www.azure.cn/) | Generally Available | 2017-04-02, 2017-08-01, 2017-12-01, 2018-02-01, 2018-04-02, 2018-10-01, 2019-02-01, 2019-03-11
41-
[Azure Germany](https://azure.microsoft.com/overview/clouds/germany/) | Generally Available | 2017-04-02, 2017-08-01, 2017-12-01, 2018-02-01, 2018-04-02, 2018-10-01, 2019-02-01, 2019-03-11
38+
[All Generally Available Global Azure Regions](https://azure.microsoft.com/regions/) | Generally Available | 2017-04-02, 2017-08-01, 2017-12-01, 2018-02-01, 2018-04-02, 2018-10-01, 2019-02-01, 2019-03-11, 2019-04-30, 2019-06-01, 2019-06-04
39+
[Azure Government](https://azure.microsoft.com/overview/clouds/government/) | Generally Available | 2017-04-02, 2017-08-01, 2017-12-01, 2018-02-01, 2018-04-02, 2018-10-01, 2019-02-01, 2019-03-11, 2019-04-30
40+
[Azure China](https://www.azure.cn/) | Generally Available | 2017-04-02, 2017-08-01, 2017-12-01, 2018-02-01, 2018-04-02, 2018-10-01, 2019-02-01, 2019-03-11, 2019-04-30
41+
[Azure Germany](https://azure.microsoft.com/overview/clouds/germany/) | Generally Available | 2017-04-02, 2017-08-01, 2017-12-01, 2018-02-01, 2018-04-02, 2018-10-01, 2019-02-01, 2019-03-11, 2019-04-30
4242

4343
This table is updated when there are service updates and or new supported versions are available.
4444

@@ -372,6 +372,7 @@ resourceId | The [fully qualified](https://docs.microsoft.com/rest/api/resources
372372
sku | Specific SKU for the VM image | 2017-04-02
373373
subscriptionId | Azure subscription for the Virtual Machine | 2017-08-01
374374
tags | [Tags](../../azure-resource-manager/resource-group-using-tags.md) for your Virtual Machine | 2017-08-01
375+
tagsList | Tags formatted as a JSON array for easier programmatic parsing | 2019-06-04
375376
version | Version of the VM image | 2017-04-02
376377
vmId | [Unique identifier](https://azure.microsoft.com/blog/accessing-and-using-azure-vm-unique-id/) for the VM | 2017-04-02
377378
vmScaleSetName | [Virtual Machine ScaleSet Name](../../virtual-machine-scale-sets/virtual-machine-scale-sets-overview.md) of your virtual machine scale set | 2017-12-01
@@ -422,7 +423,7 @@ Nonce is an optional 10-digit string provided. Nonce can be used to track the re
422423
}
423424
```
424425
425-
> The signature blob is a [pkcs7](https://aka.ms/pkcs7) signed version of document. It contains the certificate used for signing along with the VM details like vmId, nonce, timeStamp for creation and expiry of the document and the plan information about the image. The plan information is only populated for Azure Market place images. The certificate can be extracted from the response and used to validate that the response is valid and is coming from Azure.
426+
> The signature blob is a [pkcs7](https://aka.ms/pkcs7) signed version of document. It contains the certificate used for signing along with the VM details like vmId, nonce, subscriptionId, timeStamp for creation and expiry of the document and the plan information about the image. The plan information is only populated for Azure Market place images. The certificate can be extracted from the response and used to validate that the response is valid and is coming from Azure.
426427
427428
#### Retrieving attested metadata in Windows Virtual Machine
428429
@@ -454,7 +455,7 @@ Nonce is an optional 10-digit string provided. Nonce can be used to track the re
454455
}
455456
```
456457
457-
> The signature blob is a [pkcs7](https://aka.ms/pkcs7) signed version of document. It contains the certificate used for signing along with the VM details like vmId, nonce, timeStamp for creation and expiry of the document and the plan information about the image. The plan information is only populated for Azure Market place images. The certificate can be extracted from the response and used to validate that the response is valid and is coming from Azure.
458+
> The signature blob is a [pkcs7](https://aka.ms/pkcs7) signed version of document. It contains the certificate used for signing along with the VM details like vmId, nonce, subscriptionId, timeStamp for creation and expiry of the document and the plan information about the image. The plan information is only populated for Azure Market place images. The certificate can be extracted from the response and used to validate that the response is valid and is coming from Azure.
458459
459460
460461
## Example scenarios for usage
@@ -566,8 +567,32 @@ curl -H Metadata:true "http://169.254.169.254/metadata/instance/compute/tags?api
566567
Department:IT;Environment:Test;Role:WebRole
567568
```
568569
569-
> [!NOTE]
570-
> The tags are semicolon separated. If a parser is written to programmatically extract the tags, the tag names and values shouldn't contain semicolons in order for the parser to work correctly.
570+
The `tags` field is a string with the tags delimited by semicolons. This can be a problem if semicolons are used in the tags themselves. If a parser is written to programmatically extract the tags, you should rely on the `tagsList` field which is a JSON array with no delimiters, and consequently, easier to parse.
571+
572+
**Request**
573+
574+
```bash
575+
curl -H Metadata:true "http://169.254.169.254/metadata/instance/compute/tagsList?api-version=2019-06-04&format=text"
576+
```
577+
578+
**Response**
579+
580+
```json
581+
[
582+
{
583+
"name": "Department",
584+
"value": "IT"
585+
},
586+
{
587+
"name": "Environment",
588+
"value": "Test"
589+
},
590+
{
591+
"name": "Role",
592+
"value": "WebRole"
593+
}
594+
]
595+
```
571596
572597
### Validating that the VM is running in Azure
573598
@@ -610,7 +635,8 @@ Verification successful
610635
"createdOn":"11/28/18 00:16:17 -0000",
611636
"expiresOn":"11/28/18 06:16:17 -0000"
612637
},
613-
"vmId":"d3e0e374-fda6-4649-bbc9-7f20dc379f34"
638+
"vmId":"d3e0e374-fda6-4649-bbc9-7f20dc379f34",
639+
"subscriptionId": "xxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx"
614640
}
615641
```
616642
@@ -621,10 +647,11 @@ plan | [Plan](https://docs.microsoft.com/rest/api/compute/virtualmachines/create
621647
timestamp/createdOn | The timestamp at which the first signed document was created
622648
timestamp/expiresOn | The timestamp at which the signed document expires
623649
vmId | [Unique identifier](https://azure.microsoft.com/blog/accessing-and-using-azure-vm-unique-id/) for the VM
650+
subscriptionId | Azure subscription for the Virtual Machine, introduced in `2019-04-30`
624651
625652
#### Verifying the signature
626653
627-
Once you get the signature above, you can verify that the signature is from Microsoft. Also you can verify the intermediate certificate and the certificate chain.
654+
Once you get the signature above, you can verify that the signature is from Microsoft. Also you can verify the intermediate certificate and the certificate chain. Lastly, you can verify the subscription ID is correct.
628655
629656
> [!NOTE]
630657
> The certificate for Public cloud and sovereign cloud will be different.

0 commit comments

Comments
 (0)