diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceOSFamilies_List.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceOSFamilies_List.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceOSFamilies_List.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceOSFamilies_List.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceOSFamily_Get.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceOSFamily_Get.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceOSFamily_Get.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceOSFamily_Get.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceOSVersion_Get.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceOSVersion_Get.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceOSVersion_Get.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceOSVersion_Get.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceOSVersion_List.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceOSVersion_List.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceOSVersion_List.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceOSVersion_List.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Delete.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Delete.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Delete.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Delete_ByCloudService.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Delete_ByCloudService.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Delete_ByCloudService.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Delete_ByCloudService.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Get.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Get.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Get.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Get.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Get_InstanceView.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Get_InstanceView.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Get_InstanceView.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Get_InstanceView.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Get_RemoteDesktopFile.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Get_RemoteDesktopFile.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Get_RemoteDesktopFile.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Get_RemoteDesktopFile.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Rebuild.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Rebuild.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Rebuild.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Rebuild.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Rebuild_ByCloudService.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Rebuild_ByCloudService.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Rebuild_ByCloudService.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Rebuild_ByCloudService.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Reimage.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Reimage.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Reimage.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Reimage.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Reimage_ByCloudService.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Reimage_ByCloudService.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Reimage_ByCloudService.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Reimage_ByCloudService.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Restart.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Restart.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Restart.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Restart.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Restart_ByCloudService.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Restart_ByCloudService.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Restart_ByCloudService.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRoleInstance_Restart_ByCloudService.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRole_Get.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRole_Get.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRole_Get.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRole_Get.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRole_List.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRole_List.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRole_List.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRole_List.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRolesInstance_List.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRolesInstance_List.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRolesInstance_List.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceRolesInstance_List.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceUpdateDomain_Get.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceUpdateDomain_Get.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceUpdateDomain_Get.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceUpdateDomain_Get.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceUpdateDomain_List.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceUpdateDomain_List.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceUpdateDomain_List.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceUpdateDomain_List.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceUpdateDomain_Update.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceUpdateDomain_Update.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceUpdateDomain_Update.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudServiceUpdateDomain_Update.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithMultiRole.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithMultiRole.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithMultiRole.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithMultiRole.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithMultiRole_WithZones.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithMultiRole_WithZones.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithMultiRole_WithZones.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithMultiRole_WithZones.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithSingleRole.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithSingleRole.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithSingleRole.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithSingleRole.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithSingleRoleAndCertificate.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithSingleRoleAndCertificate.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithSingleRoleAndCertificate.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithSingleRoleAndCertificate.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithSingleRoleAndRDP.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithSingleRoleAndRDP.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithSingleRoleAndRDP.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Create_WithSingleRoleAndRDP.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Delete.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Delete.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Delete.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Get_InstanceViewWithMultiRole.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Get_InstanceViewWithMultiRole.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Get_InstanceViewWithMultiRole.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Get_InstanceViewWithMultiRole.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Get_WithMultiRoleAndRDP.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Get_WithMultiRoleAndRDP.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Get_WithMultiRoleAndRDP.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Get_WithMultiRoleAndRDP.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_List_ByResourceGroup.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_List_ByResourceGroup.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_List_ByResourceGroup.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_List_ByResourceGroup.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_List_BySubscription.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_List_BySubscription.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_List_BySubscription.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_List_BySubscription.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_PowerOff.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_PowerOff.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_PowerOff.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_PowerOff.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Start.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Start.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Start.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Start.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Update_ToIncludeTags.json b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Update_ToIncludeTags.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Update_ToIncludeTags.json +++ b/specification/compute/resource-manager/Microsoft.Compute/CloudserviceRP/stable/2024-11-04/examples-python/CloudService_Update_ToIncludeTags.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_CancelMigrationToVirtualMachineScaleSet.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_CancelMigrationToVirtualMachineScaleSet.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_CancelMigrationToVirtualMachineScaleSet.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_CancelMigrationToVirtualMachineScaleSet.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_CancelMigrationToVirtualMachineScaleSet.py new file mode 100644 index 00000000000..1ffe033aabb --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_CancelMigrationToVirtualMachineScaleSet.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python availability_set_cancel_migration_to_virtual_machine_scale_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.availability_sets.cancel_migration_to_virtual_machine_scale_set( + resource_group_name="rgcompute", + availability_set_name="myAvailabilitySet", + ) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_CancelMigrationToVirtualMachineScaleSet.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ConvertToVirtualMachineScaleSet.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ConvertToVirtualMachineScaleSet.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ConvertToVirtualMachineScaleSet.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ConvertToVirtualMachineScaleSet.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ConvertToVirtualMachineScaleSet.py new file mode 100644 index 00000000000..f4110ce29b8 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ConvertToVirtualMachineScaleSet.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python availability_set_convert_to_virtual_machine_scale_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.availability_sets.begin_convert_to_virtual_machine_scale_set( + resource_group_name="rgcompute", + availability_set_name="myAvailabilitySet", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_ConvertToVirtualMachineScaleSet.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Create.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Create.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Create.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Create.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Create.py new file mode 100644 index 00000000000..564b6e18284 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Create.py @@ -0,0 +1,38 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python availability_set_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.availability_sets.create_or_update( + resource_group_name="myResourceGroup", + availability_set_name="myAvailabilitySet", + parameters={ + "location": "westus", + "properties": {"platformFaultDomainCount": 2, "platformUpdateDomainCount": 20}, + }, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Create.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Create_WithScheduledEventProfile.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Create_WithScheduledEventProfile.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Create_WithScheduledEventProfile.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Create_WithScheduledEventProfile.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Create_WithScheduledEventProfile.py new file mode 100644 index 00000000000..4707e425f5d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Create_WithScheduledEventProfile.py @@ -0,0 +1,38 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python availability_set_create_with_scheduled_event_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.availability_sets.create_or_update( + resource_group_name="myResourceGroup", + availability_set_name="myAvailabilitySet", + parameters={ + "location": "westus", + "properties": {"platformFaultDomainCount": 2, "platformUpdateDomainCount": 20}, + }, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Create_WithScheduledEventProfile.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Delete_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Delete_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Delete_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Delete_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Delete_MaximumSet_Gen.py new file mode 100644 index 00000000000..f0d2ae6b44b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Delete_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python availability_set_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.availability_sets.delete( + resource_group_name="rgcompute", + availability_set_name="aaaaaaaaaaaaaaaaaaaa", + ) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Delete_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Delete_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Delete_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Delete_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Delete_MinimumSet_Gen.py new file mode 100644 index 00000000000..c2b9376dcdf --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Delete_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python availability_set_delete_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.availability_sets.delete( + resource_group_name="rgcompute", + availability_set_name="aaaaaaaaaaa", + ) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Delete_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Get_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Get_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Get_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Get_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Get_MaximumSet_Gen.py new file mode 100644 index 00000000000..908c2fd226a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Get_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python availability_set_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.availability_sets.get( + resource_group_name="rgcompute", + availability_set_name="aaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Get_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Get_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Get_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Get_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Get_MinimumSet_Gen.py new file mode 100644 index 00000000000..2d00c1866e0 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Get_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python availability_set_get_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.availability_sets.get( + resource_group_name="rgcompute", + availability_set_name="aaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Get_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MaximumSet_Gen.py new file mode 100644 index 00000000000..b66350f25aa --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MaximumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python availability_set_list_available_sizes_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.availability_sets.list_available_sizes( + resource_group_name="rgcompute", + availability_set_name="aaaaaaaaaaaaaaaaaaaa", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MinimumSet_Gen.py new file mode 100644 index 00000000000..6e3474b33b7 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MinimumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python availability_set_list_available_sizes_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.availability_sets.list_available_sizes( + resource_group_name="rgcompute", + availability_set_name="aa", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_ListAvailableSizes_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListBySubscription.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListBySubscription.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListBySubscription.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListBySubscription.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListBySubscription.py new file mode 100644 index 00000000000..11c8b5678fe --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ListBySubscription.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python availability_set_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.availability_sets.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_List_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_List_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_List_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_List_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_List_MaximumSet_Gen.py new file mode 100644 index 00000000000..35bb3ff4d01 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_List_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python availability_set_list_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.availability_sets.list( + resource_group_name="rgcompute", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_List_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_List_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_List_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_List_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_List_MinimumSet_Gen.py new file mode 100644 index 00000000000..c03b56bf14c --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_List_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python availability_set_list_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.availability_sets.list( + resource_group_name="rgcompute", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_List_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_StartMigrationToVirtualMachineScaleSet.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_StartMigrationToVirtualMachineScaleSet.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_StartMigrationToVirtualMachineScaleSet.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_StartMigrationToVirtualMachineScaleSet.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_StartMigrationToVirtualMachineScaleSet.py new file mode 100644 index 00000000000..895920d0865 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_StartMigrationToVirtualMachineScaleSet.py @@ -0,0 +1,38 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python availability_set_start_migration_to_virtual_machine_scale_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.availability_sets.start_migration_to_virtual_machine_scale_set( + resource_group_name="rgcompute", + availability_set_name="myAvailabilitySet", + parameters={ + "virtualMachineScaleSetFlexible": { + "id": "/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}" + } + }, + ) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_StartMigrationToVirtualMachineScaleSet.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Update_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Update_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Update_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Update_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Update_MaximumSet_Gen.py new file mode 100644 index 00000000000..60a0a6b0dd3 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_Update_MaximumSet_Gen.py @@ -0,0 +1,50 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python availability_set_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.availability_sets.update( + resource_group_name="rgcompute", + availability_set_name="aaaaaaaaaaaaaaaaaaa", + parameters={ + "properties": { + "platformFaultDomainCount": 2, + "platformUpdateDomainCount": 20, + "proximityPlacementGroup": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + }, + "virtualMachines": [ + { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + ], + }, + "sku": {"capacity": 7, "name": "DSv3-Type1", "tier": "aaa"}, + "tags": {"key2574": "aaaaaaaa"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ValidateMigrationToVirtualMachineScaleSet.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ValidateMigrationToVirtualMachineScaleSet.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ValidateMigrationToVirtualMachineScaleSet.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ValidateMigrationToVirtualMachineScaleSet.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ValidateMigrationToVirtualMachineScaleSet.py new file mode 100644 index 00000000000..afd2c96ec29 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/availabilitySetExamples/AvailabilitySet_ValidateMigrationToVirtualMachineScaleSet.py @@ -0,0 +1,38 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python availability_set_validate_migration_to_virtual_machine_scale_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.availability_sets.validate_migration_to_virtual_machine_scale_set( + resource_group_name="rgcompute", + availability_set_name="myAvailabilitySet", + parameters={ + "virtualMachineScaleSetFlexible": { + "id": "/subscriptions/{subscription-id}/resourceGroups/rgcompute/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}" + } + }, + ) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/availabilitySetExamples/AvailabilitySet_ValidateMigrationToVirtualMachineScaleSet.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservationGroup_CreateOrUpdate.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservationGroup_CreateOrUpdate.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservationGroup_CreateOrUpdate.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservationGroup_CreateOrUpdate.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservationGroup_CreateOrUpdate.py new file mode 100644 index 00000000000..5e90a77a938 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservationGroup_CreateOrUpdate.py @@ -0,0 +1,40 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python block_capacity_reservation_group_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.capacity_reservation_groups.create_or_update( + resource_group_name="myResourceGroup", + capacity_reservation_group_name="blockCapacityReservationGroup", + parameters={ + "location": "westus", + "properties": {"reservationType": "Block"}, + "tags": {"department": "finance"}, + "zones": ["1", "2"], + }, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/BlockCapacityReservationGroup_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservationGroup_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservationGroup_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservationGroup_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservationGroup_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservationGroup_Get.py new file mode 100644 index 00000000000..0ca6806e26c --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservationGroup_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python block_capacity_reservation_group_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.capacity_reservation_groups.get( + resource_group_name="myResourceGroup", + capacity_reservation_group_name="blockCapacityReservationGroup", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/BlockCapacityReservationGroup_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_CreateOrUpdate.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_CreateOrUpdate.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_CreateOrUpdate.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_CreateOrUpdate.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_CreateOrUpdate.py new file mode 100644 index 00000000000..4057fa172b1 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_CreateOrUpdate.py @@ -0,0 +1,42 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python block_capacity_reservation_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.capacity_reservations.begin_create_or_update( + resource_group_name="myResourceGroup", + capacity_reservation_group_name="blockCapacityReservationGroup", + capacity_reservation_name="blockCapacityReservation", + parameters={ + "location": "westus", + "properties": {"scheduleProfile": {"end": "2025-08-02", "start": "2025-08-01"}}, + "sku": {"capacity": 1, "name": "Standard_ND96isr_H100_v5"}, + "tags": {"department": "HR"}, + "zones": ["1"], + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/BlockCapacityReservation_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_Get.py new file mode 100644 index 00000000000..3f4c8090159 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_Get.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python block_capacity_reservation_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.capacity_reservations.get( + resource_group_name="myResourceGroup", + capacity_reservation_group_name="blockCapacityReservationGroup", + capacity_reservation_name="blockCapacityReservation", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/BlockCapacityReservation_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_ListByReservationGroup.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_ListByReservationGroup.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_ListByReservationGroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_ListByReservationGroup.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_ListByReservationGroup.py new file mode 100644 index 00000000000..d49df9bac0d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/BlockCapacityReservation_ListByReservationGroup.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python block_capacity_reservation_list_by_reservation_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.capacity_reservations.list_by_capacity_reservation_group( + resource_group_name="myResourceGroup", + capacity_reservation_group_name="blockCapacityReservationGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/BlockCapacityReservation_ListByReservationGroup.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_CreateOrUpdate.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_CreateOrUpdate.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_CreateOrUpdate.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_CreateOrUpdate.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_CreateOrUpdate.py new file mode 100644 index 00000000000..510eaad3422 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_CreateOrUpdate.py @@ -0,0 +1,47 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python capacity_reservation_group_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.capacity_reservation_groups.create_or_update( + resource_group_name="myResourceGroup", + capacity_reservation_group_name="myCapacityReservationGroup", + parameters={ + "location": "westus", + "properties": { + "sharingProfile": { + "subscriptionIds": [ + {"id": "/subscriptions/{subscription-id1}"}, + {"id": "/subscriptions/{subscription-id2}"}, + ] + } + }, + "tags": {"department": "finance"}, + "zones": ["1", "2"], + }, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Delete_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Delete_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Delete_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Delete_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Delete_MaximumSet_Gen.py new file mode 100644 index 00000000000..875dabe7673 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Delete_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python capacity_reservation_group_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.capacity_reservation_groups.delete( + resource_group_name="rgcompute", + capacity_reservation_group_name="a", + ) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Delete_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Delete_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Delete_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Delete_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Delete_MinimumSet_Gen.py new file mode 100644 index 00000000000..d503435f8ab --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Delete_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python capacity_reservation_group_delete_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.capacity_reservation_groups.delete( + resource_group_name="rgcompute", + capacity_reservation_group_name="aaaaaaaaaaaaaaaaaaaaaaaaaa", + ) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_Delete_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Get.py new file mode 100644 index 00000000000..463e0cd3987 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python capacity_reservation_group_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.capacity_reservation_groups.get( + resource_group_name="myResourceGroup", + capacity_reservation_group_name="myCapacityReservationGroup", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListByResourceGroup.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListByResourceGroup.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListByResourceGroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListByResourceGroup.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListByResourceGroup.py new file mode 100644 index 00000000000..c23bf1b2766 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListByResourceGroup.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python capacity_reservation_group_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.capacity_reservation_groups.list_by_resource_group( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListBySubscription.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListBySubscription.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListBySubscription.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListBySubscription.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListBySubscription.py new file mode 100644 index 00000000000..e947329444a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListBySubscription.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python capacity_reservation_group_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.capacity_reservation_groups.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListBySubscriptionWithResourceIdsQuery.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListBySubscriptionWithResourceIdsQuery.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListBySubscriptionWithResourceIdsQuery.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListBySubscriptionWithResourceIdsQuery.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListBySubscriptionWithResourceIdsQuery.py new file mode 100644 index 00000000000..8141867f95a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_ListBySubscriptionWithResourceIdsQuery.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python capacity_reservation_group_list_by_subscription_with_resource_ids_query.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.capacity_reservation_groups.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_ListBySubscriptionWithResourceIdsQuery.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Update_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Update_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Update_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Update_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Update_MaximumSet_Gen.py new file mode 100644 index 00000000000..4457ef44416 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservationGroup_Update_MaximumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python capacity_reservation_group_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.capacity_reservation_groups.update( + resource_group_name="rgcompute", + capacity_reservation_group_name="aaaaaaaaaaaaaaaaaaaaaa", + parameters={"properties": {"instanceView": {}}, "tags": {"key5355": "aaa"}}, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservationGroup_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_CreateOrUpdate.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_CreateOrUpdate.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_CreateOrUpdate.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_CreateOrUpdate.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_CreateOrUpdate.py new file mode 100644 index 00000000000..8565714a7d7 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_CreateOrUpdate.py @@ -0,0 +1,41 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python capacity_reservation_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.capacity_reservations.begin_create_or_update( + resource_group_name="myResourceGroup", + capacity_reservation_group_name="myCapacityReservationGroup", + capacity_reservation_name="myCapacityReservation", + parameters={ + "location": "westus", + "sku": {"capacity": 4, "name": "Standard_DS1_v2"}, + "tags": {"department": "HR"}, + "zones": ["1"], + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Delete_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Delete_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Delete_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Delete_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Delete_MaximumSet_Gen.py new file mode 100644 index 00000000000..8d52af09fac --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Delete_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python capacity_reservation_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.capacity_reservations.begin_delete( + resource_group_name="rgcompute", + capacity_reservation_group_name="aaaaaaaaaaa", + capacity_reservation_name="aaaaaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Delete_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Delete_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Delete_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Delete_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Delete_MinimumSet_Gen.py new file mode 100644 index 00000000000..24d5b9b9f95 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Delete_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python capacity_reservation_delete_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.capacity_reservations.begin_delete( + resource_group_name="rgcompute", + capacity_reservation_group_name="aaa", + capacity_reservation_name="aaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_Delete_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Get.py new file mode 100644 index 00000000000..1cb5ef79ac3 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Get.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python capacity_reservation_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.capacity_reservations.get( + resource_group_name="myResourceGroup", + capacity_reservation_group_name="myCapacityReservationGroup", + capacity_reservation_name="myCapacityReservation", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_ListByReservationGroup.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_ListByReservationGroup.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_ListByReservationGroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_ListByReservationGroup.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_ListByReservationGroup.py new file mode 100644 index 00000000000..73376dafaa3 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_ListByReservationGroup.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python capacity_reservation_list_by_reservation_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.capacity_reservations.list_by_capacity_reservation_group( + resource_group_name="myResourceGroup", + capacity_reservation_group_name="myCapacityReservationGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_ListByReservationGroup.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Update_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Update_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Update_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Update_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Update_MaximumSet_Gen.py new file mode 100644 index 00000000000..4a8a550153a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/CapacityReservation_Update_MaximumSet_Gen.py @@ -0,0 +1,53 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python capacity_reservation_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.capacity_reservations.begin_update( + resource_group_name="rgcompute", + capacity_reservation_group_name="aaaaaaaaaa", + capacity_reservation_name="aaaaaaaaaaaaaaaaaaa", + parameters={ + "properties": { + "instanceView": { + "statuses": [ + { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z", + } + ], + "utilizationInfo": {}, + } + }, + "sku": {"capacity": 7, "name": "Standard_DS1_v2", "tier": "aaa"}, + "tags": {"key4974": "aaaaaaaaaaaaaaaa"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/CapacityReservation_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservationGroup_CreateOrUpdate.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservationGroup_CreateOrUpdate.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservationGroup_CreateOrUpdate.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservationGroup_CreateOrUpdate.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservationGroup_CreateOrUpdate.py new file mode 100644 index 00000000000..701210c58ea --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservationGroup_CreateOrUpdate.py @@ -0,0 +1,48 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python targeted_capacity_reservation_group_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.capacity_reservation_groups.create_or_update( + resource_group_name="myResourceGroup", + capacity_reservation_group_name="targetedCapacityReservationGroup", + parameters={ + "location": "westus", + "properties": { + "reservationType": "Targeted", + "sharingProfile": { + "subscriptionIds": [ + {"id": "/subscriptions/{subscription-id1}"}, + {"id": "/subscriptions/{subscription-id2}"}, + ] + }, + }, + "tags": {"department": "finance"}, + "zones": ["1", "2"], + }, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/TargetedCapacityReservationGroup_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservationGroup_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservationGroup_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservationGroup_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservationGroup_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservationGroup_Get.py new file mode 100644 index 00000000000..524a9b8ed62 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservationGroup_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python targeted_capacity_reservation_group_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.capacity_reservation_groups.get( + resource_group_name="myResourceGroup", + capacity_reservation_group_name="targetedCapacityReservationGroup", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/TargetedCapacityReservationGroup_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_CreateOrUpdate.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_CreateOrUpdate.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_CreateOrUpdate.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_CreateOrUpdate.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_CreateOrUpdate.py new file mode 100644 index 00000000000..216822bad4b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_CreateOrUpdate.py @@ -0,0 +1,41 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python targeted_capacity_reservation_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.capacity_reservations.begin_create_or_update( + resource_group_name="myResourceGroup", + capacity_reservation_group_name="targetedCapacityReservationGroup", + capacity_reservation_name="targetedCapacityReservation", + parameters={ + "location": "westus", + "sku": {"capacity": 4, "name": "Standard_DS1_v2"}, + "tags": {"department": "HR"}, + "zones": ["1"], + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/TargetedCapacityReservation_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_Get.py new file mode 100644 index 00000000000..c9aa48cfdc1 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_Get.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python targeted_capacity_reservation_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.capacity_reservations.get( + resource_group_name="myResourceGroup", + capacity_reservation_group_name="targetedCapacityReservationGroup", + capacity_reservation_name="targetedCapacityReservation", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/TargetedCapacityReservation_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_ListByReservationGroup.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_ListByReservationGroup.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_ListByReservationGroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_ListByReservationGroup.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_ListByReservationGroup.py new file mode 100644 index 00000000000..723c1e82faf --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/capacityReservationExamples/TargetedCapacityReservation_ListByReservationGroup.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python targeted_capacity_reservation_list_by_reservation_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.capacity_reservations.list_by_capacity_reservation_group( + resource_group_name="myResourceGroup", + capacity_reservation_group_name="targetedCapacityReservationGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/capacityReservationExamples/TargetedCapacityReservation_ListByReservationGroup.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Operations_List_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Operations_List_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Operations_List_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Operations_List_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Operations_List_MaximumSet_Gen.py new file mode 100644 index 00000000000..7def5eb518a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Operations_List_MaximumSet_Gen.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python operations_list_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/computeRPCommonExamples/Operations_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Operations_List_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Operations_List_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Operations_List_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Operations_List_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Operations_List_MinimumSet_Gen.py new file mode 100644 index 00000000000..2027602dc5a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Operations_List_MinimumSet_Gen.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python operations_list_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/computeRPCommonExamples/Operations_List_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Usage_List_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Usage_List_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Usage_List_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Usage_List_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Usage_List_MaximumSet_Gen.py new file mode 100644 index 00000000000..12302b8bbc6 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Usage_List_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python usage_list_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.usage.list( + location="4_.", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/computeRPCommonExamples/Usage_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Usage_List_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Usage_List_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Usage_List_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Usage_List_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Usage_List_MinimumSet_Gen.py new file mode 100644 index 00000000000..735a250ba38 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/Usage_List_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python usage_list_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.usage.list( + location="_--", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/computeRPCommonExamples/Usage_List_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/VirtualMachineSizes_List_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/VirtualMachineSizes_List_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/VirtualMachineSizes_List_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/VirtualMachineSizes_List_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/VirtualMachineSizes_List_MaximumSet_Gen.py new file mode 100644 index 00000000000..353e6214f9c --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/VirtualMachineSizes_List_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_sizes_list_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_sizes.list( + location="-e", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/computeRPCommonExamples/VirtualMachineSizes_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/VirtualMachineSizes_List_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/VirtualMachineSizes_List_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/VirtualMachineSizes_List_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/VirtualMachineSizes_List_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/VirtualMachineSizes_List_MinimumSet_Gen.py new file mode 100644 index 00000000000..62f4a92db06 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/computeRPCommonExamples/VirtualMachineSizes_List_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_sizes_list_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_sizes.list( + location="._..", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/computeRPCommonExamples/VirtualMachineSizes_List_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate.py new file mode 100644 index 00000000000..2812660be15 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate.py @@ -0,0 +1,40 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_group_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.dedicated_host_groups.create_or_update( + resource_group_name="myResourceGroup", + host_group_name="myDedicatedHostGroup", + parameters={ + "location": "westus", + "properties": {"platformFaultDomainCount": 3, "supportAutomaticPlacement": True}, + "tags": {"department": "finance"}, + "zones": ["1"], + }, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate_WithUltraSSD.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate_WithUltraSSD.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate_WithUltraSSD.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate_WithUltraSSD.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate_WithUltraSSD.py new file mode 100644 index 00000000000..c7355691006 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate_WithUltraSSD.py @@ -0,0 +1,44 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_group_create_or_update_with_ultra_ssd.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.dedicated_host_groups.create_or_update( + resource_group_name="myResourceGroup", + host_group_name="myDedicatedHostGroup", + parameters={ + "location": "westus", + "properties": { + "additionalCapabilities": {"ultraSSDEnabled": True}, + "platformFaultDomainCount": 3, + "supportAutomaticPlacement": True, + }, + "tags": {"department": "finance"}, + "zones": ["1"], + }, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_CreateOrUpdate_WithUltraSSD.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Delete_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Delete_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Delete_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Delete_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Delete_MaximumSet_Gen.py new file mode 100644 index 00000000000..d7e3daf0dd6 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Delete_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_group_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.dedicated_host_groups.delete( + resource_group_name="rgcompute", + host_group_name="a", + ) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Delete_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Delete_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Delete_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Delete_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Delete_MinimumSet_Gen.py new file mode 100644 index 00000000000..94c72d59a3b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Delete_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_group_delete_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.dedicated_host_groups.delete( + resource_group_name="rgcompute", + host_group_name="aaaa", + ) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_Delete_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Get.py new file mode 100644 index 00000000000..eaad3f810e1 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_group_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.dedicated_host_groups.get( + resource_group_name="myResourceGroup", + host_group_name="myDedicatedHostGroup", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Get_UltraSSDEnabledDedicatedHostGroup.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Get_UltraSSDEnabledDedicatedHostGroup.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Get_UltraSSDEnabledDedicatedHostGroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Get_UltraSSDEnabledDedicatedHostGroup.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Get_UltraSSDEnabledDedicatedHostGroup.py new file mode 100644 index 00000000000..f1d7759a464 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Get_UltraSSDEnabledDedicatedHostGroup.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_group_get_ultra_ssd_enabled_dedicated_host_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.dedicated_host_groups.get( + resource_group_name="myResourceGroup", + host_group_name="myDedicatedHostGroup", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_Get_UltraSSDEnabledDedicatedHostGroup.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MaximumSet_Gen.py new file mode 100644 index 00000000000..ac125feacdd --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_group_list_by_resource_group_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.dedicated_host_groups.list_by_resource_group( + resource_group_name="rgcompute", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MinimumSet_Gen.py new file mode 100644 index 00000000000..f51da70c303 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_group_list_by_resource_group_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.dedicated_host_groups.list_by_resource_group( + resource_group_name="rgcompute", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListByResourceGroup_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MaximumSet_Gen.py new file mode 100644 index 00000000000..a2c4fa2072c --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MaximumSet_Gen.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_group_list_by_subscription_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.dedicated_host_groups.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MinimumSet_Gen.py new file mode 100644 index 00000000000..b6c1aac7432 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MinimumSet_Gen.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_group_list_by_subscription_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.dedicated_host_groups.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_ListBySubscription_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Update_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Update_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Update_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Update_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Update_MaximumSet_Gen.py new file mode 100644 index 00000000000..312cebfd3ac --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHostGroup_Update_MaximumSet_Gen.py @@ -0,0 +1,58 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_group_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.dedicated_host_groups.update( + resource_group_name="rgcompute", + host_group_name="aaaa", + parameters={ + "properties": { + "instanceView": { + "hosts": [ + { + "availableCapacity": {"allocatableVMs": [{"count": 26, "vmSize": "aaaaaaaaaaaaaaaaaaaa"}]}, + "statuses": [ + { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z", + } + ], + } + ] + }, + "platformFaultDomainCount": 3, + "supportAutomaticPlacement": True, + }, + "tags": {"key9921": "aaaaaaaaaa"}, + "zones": ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"], + }, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHostGroup_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_CreateOrUpdate.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_CreateOrUpdate.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_CreateOrUpdate.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_CreateOrUpdate.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_CreateOrUpdate.py new file mode 100644 index 00000000000..067c4edfb19 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_CreateOrUpdate.py @@ -0,0 +1,41 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.dedicated_hosts.begin_create_or_update( + resource_group_name="myResourceGroup", + host_group_name="myDedicatedHostGroup", + host_name="myDedicatedHost", + parameters={ + "location": "westus", + "properties": {"platformFaultDomain": 1}, + "sku": {"name": "DSv3-Type1"}, + "tags": {"department": "HR"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Delete_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Delete_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Delete_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Delete_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Delete_MaximumSet_Gen.py new file mode 100644 index 00000000000..5a9f7e41acf --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Delete_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.dedicated_hosts.begin_delete( + resource_group_name="rgcompute", + host_group_name="aaaaaa", + host_name="aaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Delete_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Delete_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Delete_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Delete_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Delete_MinimumSet_Gen.py new file mode 100644 index 00000000000..30ba4742367 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Delete_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_delete_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.dedicated_hosts.begin_delete( + resource_group_name="rgcompute", + host_group_name="aaaaaaaaaaaaaaa", + host_name="aaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Delete_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Get.py new file mode 100644 index 00000000000..3a2c65aa33d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Get.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.dedicated_hosts.get( + resource_group_name="myResourceGroup", + host_group_name="myDedicatedHostGroup", + host_name="myHost", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListAvailableSizes.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListAvailableSizes.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListAvailableSizes.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListAvailableSizes.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListAvailableSizes.py new file mode 100644 index 00000000000..8d7ca4ce906 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListAvailableSizes.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_list_available_sizes.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.dedicated_hosts.list_available_sizes( + resource_group_name="myResourceGroup", + host_group_name="myDedicatedHostGroup", + host_name="myHost", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_ListAvailableSizes.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MaximumSet_Gen.py new file mode 100644 index 00000000000..7936af5d812 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MaximumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_list_by_host_group_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.dedicated_hosts.list_by_host_group( + resource_group_name="rgcompute", + host_group_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MinimumSet_Gen.py new file mode 100644 index 00000000000..d3dd8b0ea95 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MinimumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_list_by_host_group_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.dedicated_hosts.list_by_host_group( + resource_group_name="rgcompute", + host_group_name="aaaa", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_ListByHostGroup_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Redeploy.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Redeploy.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Redeploy.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Redeploy.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Redeploy.py new file mode 100644 index 00000000000..142ba12a667 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Redeploy.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_redeploy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.dedicated_hosts.begin_redeploy( + resource_group_name="myResourceGroup", + host_group_name="myDedicatedHostGroup", + host_name="myHost", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Redeploy.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Restart.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Restart.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Restart.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Restart.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Restart.py new file mode 100644 index 00000000000..7f8d06752b2 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Restart.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_restart.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.dedicated_hosts.begin_restart( + resource_group_name="myResourceGroup", + host_group_name="myDedicatedHostGroup", + host_name="myHost", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Restart.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Update_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Update_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Update_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Update_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Update_MaximumSet_Gen.py new file mode 100644 index 00000000000..51823094f7c --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Update_MaximumSet_Gen.py @@ -0,0 +1,55 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.dedicated_hosts.begin_update( + resource_group_name="rgcompute", + host_group_name="aaaaaaaaa", + host_name="aaaaaaaaaaaaaaaaaaaaa", + parameters={ + "properties": { + "autoReplaceOnFailure": True, + "instanceView": { + "availableCapacity": {"allocatableVMs": [{"count": 26, "vmSize": "aaaaaaaaaaaaaaaaaaaa"}]}, + "statuses": [ + { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z", + } + ], + }, + "licenseType": "Windows_Server_Hybrid", + "platformFaultDomain": 1, + }, + "tags": {"key8813": "aaaaaaaaaaaaaaaaaaaaaaaaaaa"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Update_Resize.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Update_Resize.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Update_Resize.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Update_Resize.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Update_Resize.py new file mode 100644 index 00000000000..c45b2a01113 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/dedicatedHostExamples/DedicatedHost_Update_Resize.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python dedicated_host_update_resize.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.dedicated_hosts.begin_update( + resource_group_name="rgcompute", + host_group_name="aaaaaaaaa", + host_name="aaaaaaaaaaaaaaaaaaaaa", + parameters={"sku": {"name": "DSv3-Type1"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/dedicatedHostExamples/DedicatedHost_Update_Resize.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromABlob.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromABlob.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromABlob.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromABlob.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromABlob.py new file mode 100644 index 00000000000..81991f35ab1 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromABlob.py @@ -0,0 +1,47 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python image_create_from_ablob.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.images.begin_create_or_update( + resource_group_name="myResourceGroup", + image_name="myImage", + parameters={ + "location": "West US", + "properties": { + "storageProfile": { + "osDisk": { + "blobUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + "osState": "Generalized", + "osType": "Linux", + }, + "zoneResilient": True, + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromABlob.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromABlobWithDiskEncryptionSet.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromABlobWithDiskEncryptionSet.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromABlobWithDiskEncryptionSet.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromABlobWithDiskEncryptionSet.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromABlobWithDiskEncryptionSet.py new file mode 100644 index 00000000000..5275083af39 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromABlobWithDiskEncryptionSet.py @@ -0,0 +1,49 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python image_create_from_ablob_with_disk_encryption_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.images.begin_create_or_update( + resource_group_name="myResourceGroup", + image_name="myImage", + parameters={ + "location": "West US", + "properties": { + "storageProfile": { + "osDisk": { + "blobUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + "diskEncryptionSet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + "osState": "Generalized", + "osType": "Linux", + } + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromABlobWithDiskEncryptionSet.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAManagedDisk.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAManagedDisk.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAManagedDisk.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAManagedDisk.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAManagedDisk.py new file mode 100644 index 00000000000..82a1bb75447 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAManagedDisk.py @@ -0,0 +1,49 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python image_create_from_amanaged_disk.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.images.begin_create_or_update( + resource_group_name="myResourceGroup", + image_name="myImage", + parameters={ + "location": "West US", + "properties": { + "storageProfile": { + "osDisk": { + "managedDisk": { + "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk" + }, + "osState": "Generalized", + "osType": "Linux", + }, + "zoneResilient": True, + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromAManagedDisk.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAManagedDiskWithDiskEncryptionSet.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAManagedDiskWithDiskEncryptionSet.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAManagedDiskWithDiskEncryptionSet.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAManagedDiskWithDiskEncryptionSet.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAManagedDiskWithDiskEncryptionSet.py new file mode 100644 index 00000000000..5498c52c924 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAManagedDiskWithDiskEncryptionSet.py @@ -0,0 +1,51 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python image_create_from_amanaged_disk_with_disk_encryption_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.images.begin_create_or_update( + resource_group_name="myResourceGroup", + image_name="myImage", + parameters={ + "location": "West US", + "properties": { + "storageProfile": { + "osDisk": { + "diskEncryptionSet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + "osState": "Generalized", + "osType": "Linux", + "snapshot": { + "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" + }, + } + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromAManagedDiskWithDiskEncryptionSet.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromASnapshot.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromASnapshot.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromASnapshot.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromASnapshot.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromASnapshot.py new file mode 100644 index 00000000000..1c4835012c5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromASnapshot.py @@ -0,0 +1,49 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python image_create_from_asnapshot.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.images.begin_create_or_update( + resource_group_name="myResourceGroup", + image_name="myImage", + parameters={ + "location": "West US", + "properties": { + "storageProfile": { + "osDisk": { + "osState": "Generalized", + "osType": "Linux", + "snapshot": { + "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" + }, + }, + "zoneResilient": False, + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromASnapshot.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromASnapshotWithDiskEncryptionSet.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromASnapshotWithDiskEncryptionSet.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromASnapshotWithDiskEncryptionSet.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromASnapshotWithDiskEncryptionSet.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromASnapshotWithDiskEncryptionSet.py new file mode 100644 index 00000000000..9d31ba0382d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromASnapshotWithDiskEncryptionSet.py @@ -0,0 +1,51 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python image_create_from_asnapshot_with_disk_encryption_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.images.begin_create_or_update( + resource_group_name="myResourceGroup", + image_name="myImage", + parameters={ + "location": "West US", + "properties": { + "storageProfile": { + "osDisk": { + "diskEncryptionSet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + "managedDisk": { + "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk" + }, + "osState": "Generalized", + "osType": "Linux", + } + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromASnapshotWithDiskEncryptionSet.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAVM.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAVM.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAVM.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAVM.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAVM.py new file mode 100644 index 00000000000..3890e7a6154 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_CreateFromAVM.py @@ -0,0 +1,42 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python image_create_from_avm.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.images.begin_create_or_update( + resource_group_name="myResourceGroup", + image_name="myImage", + parameters={ + "location": "West US", + "properties": { + "sourceVirtualMachine": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM" + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_CreateFromAVM.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromABlobIncluded.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromABlobIncluded.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromABlobIncluded.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromABlobIncluded.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromABlobIncluded.py new file mode 100644 index 00000000000..6e39811d552 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromABlobIncluded.py @@ -0,0 +1,50 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python image_create_data_disk_from_ablob_included.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.images.begin_create_or_update( + resource_group_name="myResourceGroup", + image_name="myImage", + parameters={ + "location": "West US", + "properties": { + "storageProfile": { + "dataDisks": [ + {"blobUri": "https://mystorageaccount.blob.core.windows.net/dataimages/dataimage.vhd", "lun": 1} + ], + "osDisk": { + "blobUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + "osState": "Generalized", + "osType": "Linux", + }, + "zoneResilient": False, + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_Create_DataDiskFromABlobIncluded.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromAManagedDiskIncluded.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromAManagedDiskIncluded.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromAManagedDiskIncluded.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromAManagedDiskIncluded.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromAManagedDiskIncluded.py new file mode 100644 index 00000000000..7a588d9226d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromAManagedDiskIncluded.py @@ -0,0 +1,57 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python image_create_data_disk_from_amanaged_disk_included.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.images.begin_create_or_update( + resource_group_name="myResourceGroup", + image_name="myImage", + parameters={ + "location": "West US", + "properties": { + "storageProfile": { + "dataDisks": [ + { + "lun": 1, + "managedDisk": { + "id": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk2" + }, + } + ], + "osDisk": { + "managedDisk": { + "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myManagedDisk" + }, + "osState": "Generalized", + "osType": "Linux", + }, + "zoneResilient": False, + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_Create_DataDiskFromAManagedDiskIncluded.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromASnapshotIncluded.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromASnapshotIncluded.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromASnapshotIncluded.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromASnapshotIncluded.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromASnapshotIncluded.py new file mode 100644 index 00000000000..7c32e5612eb --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Create_DataDiskFromASnapshotIncluded.py @@ -0,0 +1,57 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python image_create_data_disk_from_asnapshot_included.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.images.begin_create_or_update( + resource_group_name="myResourceGroup", + image_name="myImage", + parameters={ + "location": "West US", + "properties": { + "storageProfile": { + "dataDisks": [ + { + "lun": 1, + "snapshot": { + "id": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot2" + }, + } + ], + "osDisk": { + "osState": "Generalized", + "osType": "Linux", + "snapshot": { + "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" + }, + }, + "zoneResilient": True, + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_Create_DataDiskFromASnapshotIncluded.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Get.py new file mode 100644 index 00000000000..0b8289d606e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python image_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.images.get( + resource_group_name="myResourceGroup", + image_name="myImage", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_ListByResourceGroup.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_ListByResourceGroup.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_ListByResourceGroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_ListByResourceGroup.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_ListByResourceGroup.py new file mode 100644 index 00000000000..4d4b7e7413e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_ListByResourceGroup.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python image_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.images.list_by_resource_group( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_ListBySubscription.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_ListBySubscription.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_ListBySubscription.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_ListBySubscription.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_ListBySubscription.py new file mode 100644 index 00000000000..27c24e2734d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_ListBySubscription.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python image_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.images.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Update.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Update.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Update.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Update.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Update.py new file mode 100644 index 00000000000..e19e20b3b2b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Image_Update.py @@ -0,0 +1,43 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python image_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.images.begin_update( + resource_group_name="myResourceGroup", + image_name="myImage", + parameters={ + "properties": { + "hyperVGeneration": "V1", + "sourceVirtualMachine": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM" + }, + }, + "tags": {"department": "HR"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Image_Update.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Images_Delete_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Images_Delete_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Images_Delete_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Images_Delete_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Images_Delete_MaximumSet_Gen.py new file mode 100644 index 00000000000..12751e53085 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Images_Delete_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python images_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.images.begin_delete( + resource_group_name="rgcompute", + image_name="aaaaaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Images_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Images_Delete_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Images_Delete_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Images_Delete_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Images_Delete_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Images_Delete_MinimumSet_Gen.py new file mode 100644 index 00000000000..d1180434a85 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/imageExamples/Images_Delete_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python images_delete_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.images.begin_delete( + resource_group_name="rgcompute", + image_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/imageExamples/Images_Delete_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/logAnalyticExamples/LogAnalytics_RequestRateByInterval.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/logAnalyticExamples/LogAnalytics_RequestRateByInterval.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/logAnalyticExamples/LogAnalytics_RequestRateByInterval.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/logAnalyticExamples/LogAnalytics_RequestRateByInterval.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/logAnalyticExamples/LogAnalytics_RequestRateByInterval.py new file mode 100644 index 00000000000..2288a283074 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/logAnalyticExamples/LogAnalytics_RequestRateByInterval.py @@ -0,0 +1,40 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python log_analytics_request_rate_by_interval.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.log_analytics.begin_export_request_rate_by_interval( + location="westus", + parameters={ + "blobContainerSasUri": "https://somesasuri", + "fromTime": "2018-01-21T01:54:06.862601Z", + "groupByResourceName": True, + "intervalLength": "FiveMins", + "toTime": "2018-01-23T01:54:06.862601Z", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/logAnalyticExamples/LogAnalytics_RequestRateByInterval.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/logAnalyticExamples/LogAnalytics_ThrottledRequests.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/logAnalyticExamples/LogAnalytics_ThrottledRequests.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/logAnalyticExamples/LogAnalytics_ThrottledRequests.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/logAnalyticExamples/LogAnalytics_ThrottledRequests.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/logAnalyticExamples/LogAnalytics_ThrottledRequests.py new file mode 100644 index 00000000000..6df01a1ca99 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/logAnalyticExamples/LogAnalytics_ThrottledRequests.py @@ -0,0 +1,42 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python log_analytics_throttled_requests.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.log_analytics.begin_export_throttled_requests( + location="westus", + parameters={ + "blobContainerSasUri": "https://somesasuri", + "fromTime": "2018-01-21T01:54:06.862601Z", + "groupByClientApplicationId": False, + "groupByOperationName": True, + "groupByResourceName": False, + "groupByUserAgent": False, + "toTime": "2018-01-23T01:54:06.862601Z", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/logAnalyticExamples/LogAnalytics_ThrottledRequests.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_CreateOrUpdate.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_CreateOrUpdate.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_CreateOrUpdate.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_CreateOrUpdate.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_CreateOrUpdate.py new file mode 100644 index 00000000000..aa0cc9fd53a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_CreateOrUpdate.py @@ -0,0 +1,39 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python proximity_placement_group_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.proximity_placement_groups.create_or_update( + resource_group_name="myResourceGroup", + proximity_placement_group_name="myProximityPlacementGroup", + parameters={ + "location": "westus", + "properties": {"intent": {"vmSizes": ["Basic_A0", "Basic_A2"]}, "proximityPlacementGroupType": "Standard"}, + "zones": ["1"], + }, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Delete.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Delete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Delete.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Delete.py new file mode 100644 index 00000000000..2f572441607 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Delete.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python proximity_placement_group_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.proximity_placement_groups.delete( + resource_group_name="myResourceGroup", + proximity_placement_group_name="myProximityPlacementGroup", + ) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_Delete.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Get.py new file mode 100644 index 00000000000..077bba0f3cd --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python proximity_placement_group_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.proximity_placement_groups.get( + resource_group_name="myResourceGroup", + proximity_placement_group_name="myProximityPlacementGroup", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_ListByResourceGroup.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_ListByResourceGroup.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_ListByResourceGroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_ListByResourceGroup.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_ListByResourceGroup.py new file mode 100644 index 00000000000..5f4e00b6e0c --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_ListByResourceGroup.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python proximity_placement_group_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.proximity_placement_groups.list_by_resource_group( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_ListBySubscription.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_ListBySubscription.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_ListBySubscription.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_ListBySubscription.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_ListBySubscription.py new file mode 100644 index 00000000000..123d51d01ae --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_ListBySubscription.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python proximity_placement_group_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.proximity_placement_groups.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Patch.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Patch.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Patch.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Patch.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Patch.py new file mode 100644 index 00000000000..f4b21f66546 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/proximityPlacementGroupExamples/ProximityPlacementGroup_Patch.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python proximity_placement_group_patch.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.proximity_placement_groups.update( + resource_group_name="myResourceGroup", + proximity_placement_group_name="myProximityPlacementGroup", + parameters={"tags": {"additionalProp1": "string"}}, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/proximityPlacementGroupExamples/ProximityPlacementGroup_Patch.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_CreateOrUpdate.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_CreateOrUpdate.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_CreateOrUpdate.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_CreateOrUpdate.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_CreateOrUpdate.py new file mode 100644 index 00000000000..26e42f88900 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_CreateOrUpdate.py @@ -0,0 +1,43 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python restore_point_collection_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.restore_point_collections.create_or_update( + resource_group_name="myResourceGroup", + restore_point_collection_name="myRpc", + parameters={ + "location": "norwayeast", + "properties": { + "source": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM" + } + }, + "tags": {"myTag1": "tagValue1"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_CreateOrUpdate_ForCrossRegionCopy.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_CreateOrUpdate_ForCrossRegionCopy.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_CreateOrUpdate_ForCrossRegionCopy.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_CreateOrUpdate_ForCrossRegionCopy.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_CreateOrUpdate_ForCrossRegionCopy.py new file mode 100644 index 00000000000..af07b5b1814 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_CreateOrUpdate_ForCrossRegionCopy.py @@ -0,0 +1,43 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python restore_point_collection_create_or_update_for_cross_region_copy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.restore_point_collections.create_or_update( + resource_group_name="myResourceGroup", + restore_point_collection_name="myRpc", + parameters={ + "location": "norwayeast", + "properties": { + "source": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/sourceRpcName" + } + }, + "tags": {"myTag1": "tagValue1"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_CreateOrUpdate_ForCrossRegionCopy.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Delete_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Delete_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Delete_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Delete_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Delete_MaximumSet_Gen.py new file mode 100644 index 00000000000..607514153a1 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Delete_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python restore_point_collection_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.restore_point_collections.begin_delete( + resource_group_name="rgcompute", + restore_point_collection_name="aaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Delete_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Delete_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Delete_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Delete_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Delete_MinimumSet_Gen.py new file mode 100644 index 00000000000..e3dade06e49 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Delete_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python restore_point_collection_delete_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.restore_point_collections.begin_delete( + resource_group_name="rgcompute", + restore_point_collection_name="aaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_Delete_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Get.py new file mode 100644 index 00000000000..3e685c0d624 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python restore_point_collection_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.restore_point_collections.get( + resource_group_name="myResourceGroup", + restore_point_collection_name="myRpc", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Get_WithContainedRestorePoints.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Get_WithContainedRestorePoints.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Get_WithContainedRestorePoints.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Get_WithContainedRestorePoints.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Get_WithContainedRestorePoints.py new file mode 100644 index 00000000000..cd0dbc1a6e8 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Get_WithContainedRestorePoints.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python restore_point_collection_get_with_contained_restore_points.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.restore_point_collections.get( + resource_group_name="myResourceGroup", + restore_point_collection_name="rpcName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_Get_WithContainedRestorePoints.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_ListByResourceGroup.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_ListByResourceGroup.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_ListByResourceGroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_ListByResourceGroup.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_ListByResourceGroup.py new file mode 100644 index 00000000000..89ce026d211 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_ListByResourceGroup.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python restore_point_collection_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.restore_point_collections.list( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_ListBySubscription.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_ListBySubscription.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_ListBySubscription.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_ListBySubscription.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_ListBySubscription.py new file mode 100644 index 00000000000..dbed13569de --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_ListBySubscription.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python restore_point_collection_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.restore_point_collections.list_all() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Update_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Update_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Update_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Update_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Update_MaximumSet_Gen.py new file mode 100644 index 00000000000..2493e204696 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePointCollection_Update_MaximumSet_Gen.py @@ -0,0 +1,42 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python restore_point_collection_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.restore_point_collections.update( + resource_group_name="rgcompute", + restore_point_collection_name="aaaaaaaaaaaaaaaaaaaa", + parameters={ + "properties": { + "source": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM" + } + }, + "tags": {"key8536": "aaaaaaaaaaaaaaaaaaa"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePointCollection_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Copy_BetweenRegions.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Copy_BetweenRegions.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Copy_BetweenRegions.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Copy_BetweenRegions.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Copy_BetweenRegions.py new file mode 100644 index 00000000000..17892085212 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Copy_BetweenRegions.py @@ -0,0 +1,42 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python restore_point_copy_between_regions.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.restore_points.begin_create( + resource_group_name="myResourceGroup", + restore_point_collection_name="rpcName", + restore_point_name="rpName", + parameters={ + "properties": { + "sourceRestorePoint": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/sourceRpcName/restorePoints/sourceRpName" + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePoint_Copy_BetweenRegions.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Create.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Create.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Create.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Create.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Create.py new file mode 100644 index 00000000000..c0074252b55 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Create.py @@ -0,0 +1,44 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python restore_point_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.restore_points.begin_create( + resource_group_name="myResourceGroup", + restore_point_collection_name="rpcName", + restore_point_name="rpName", + parameters={ + "properties": { + "excludeDisks": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123" + } + ] + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePoint_Create.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Delete_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Delete_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Delete_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Delete_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Delete_MaximumSet_Gen.py new file mode 100644 index 00000000000..182401d1062 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Delete_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python restore_point_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.restore_points.begin_delete( + resource_group_name="rgcompute", + restore_point_collection_name="aaaaaaaaaaaaaaaaaaaaaa", + restore_point_name="a", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePoint_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Delete_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Delete_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Delete_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Delete_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Delete_MinimumSet_Gen.py new file mode 100644 index 00000000000..c5e4faf8006 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Delete_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python restore_point_delete_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.restore_points.begin_delete( + resource_group_name="rgcompute", + restore_point_collection_name="aaaaaaaaaaaaaaaaa", + restore_point_name="aaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePoint_Delete_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Get.py new file mode 100644 index 00000000000..a4e79c271f4 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Get.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python restore_point_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.restore_points.get( + resource_group_name="myResourceGroup", + restore_point_collection_name="rpcName", + restore_point_name="rpName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePoint_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Get_WithInstanceView.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Get_WithInstanceView.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Get_WithInstanceView.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Get_WithInstanceView.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Get_WithInstanceView.py new file mode 100644 index 00000000000..5cbbb5f413f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/restorePointExamples/RestorePoint_Get_WithInstanceView.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python restore_point_get_with_instance_view.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.restore_points.get( + resource_group_name="myResourceGroup", + restore_point_collection_name="rpcName", + restore_point_name="rpName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/restorePointExamples/RestorePoint_Get_WithInstanceView.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/RunCommand_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/RunCommand_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/RunCommand_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/RunCommand_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/RunCommand_Get.py new file mode 100644 index 00000000000..19156444584 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/RunCommand_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python run_command_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="24fb23e3-6ba3-41f0-9b6e-e41131d5d61e", + ) + + response = client.virtual_machine_run_commands.get( + location="SoutheastAsia", + command_id="RunPowerShellScript", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/RunCommand_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/RunCommand_List.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/RunCommand_List.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/RunCommand_List.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/RunCommand_List.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/RunCommand_List.py new file mode 100644 index 00000000000..fd270a5bce1 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/RunCommand_List.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python run_command_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.virtual_machine_run_commands.list( + location="SoutheastAsia", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/RunCommand_List.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand.py new file mode 100644 index 00000000000..b5841e9c735 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_run_command.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="24fb23e3-6ba3-41f0-9b6e-e41131d5d61e", + ) + + response = client.virtual_machines.begin_run_command( + resource_group_name="crptestar98131", + vm_name="vm3036", + parameters={"commandId": "RunPowerShellScript"}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineRunCommand.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_CreateOrUpdate.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_CreateOrUpdate.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_CreateOrUpdate.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_CreateOrUpdate.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_CreateOrUpdate.py new file mode 100644 index 00000000000..db801615f2d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_CreateOrUpdate.py @@ -0,0 +1,50 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_run_command_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_run_commands.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + run_command_name="myRunCommand", + run_command={ + "location": "West US", + "properties": { + "asyncExecution": False, + "errorBlobUri": "https://mystorageaccount.blob.core.windows.net/scriptcontainer/scriptURI", + "outputBlobManagedIdentity": {"clientId": "22d35efb-0c99-4041-8c5b-6d24db33a69a"}, + "outputBlobUri": "https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt", + "parameters": [{"name": "param1", "value": "value1"}, {"name": "param2", "value": "value2"}], + "runAsPassword": "", + "runAsUser": "user1", + "source": {"scriptUri": "https://mystorageaccount.blob.core.windows.net/scriptcontainer/scriptURI"}, + "timeoutInSeconds": 3600, + "treatFailureAsDeploymentFailure": False, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineRunCommand_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Delete.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Delete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Delete.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Delete.py new file mode 100644 index 00000000000..943bf40a238 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Delete.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_run_command_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_run_commands.begin_delete( + resource_group_name="myResourceGroup", + vm_name="myVM", + run_command_name="myRunCommand", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineRunCommand_Delete.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Get.py new file mode 100644 index 00000000000..ed94d43b8b6 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Get.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_run_command_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_run_commands.get_by_virtual_machine( + resource_group_name="myResourceGroup", + vm_name="myVM", + run_command_name="myRunCommand", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineRunCommand_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_List.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_List.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_List.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_List.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_List.py new file mode 100644 index 00000000000..939a3dd84a0 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_List.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_run_command_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_run_commands.list_by_virtual_machine( + resource_group_name="myResourceGroup", + vm_name="myVM", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineRunCommand_List.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Update.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Update.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Update.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Update.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Update.py new file mode 100644 index 00000000000..4df3e27f0bc --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineRunCommand_Update.py @@ -0,0 +1,48 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_run_command_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_run_commands.begin_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + run_command_name="myRunCommand", + run_command={ + "properties": { + "asyncExecution": False, + "errorBlobManagedIdentity": {"objectId": "4231e4d2-33e4-4e23-96b2-17888afa6072"}, + "errorBlobUri": "https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt", + "outputBlobUri": "https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/outputUri", + "parameters": [{"name": "param1", "value": "value1"}, {"name": "param2", "value": "value2"}], + "runAsPassword": "", + "runAsUser": "user1", + "source": {"script": "Write-Host Hello World! ; Remove-Item C:\test\testFile.txt"}, + "timeoutInSeconds": 3600, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineRunCommand_Update.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand.py new file mode 100644 index 00000000000..5f06d6cb59e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_run_command.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vms.begin_run_command( + resource_group_name="myResourceGroup", + vm_scale_set_name="myVirtualMachineScaleSet", + instance_id="0", + parameters={"commandId": "RunPowerShellScript", "script": ["Write-Host Hello World!"]}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_CreateOrUpdate.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_CreateOrUpdate.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_CreateOrUpdate.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_CreateOrUpdate.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_CreateOrUpdate.py new file mode 100644 index 00000000000..37e12b327d7 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_CreateOrUpdate.py @@ -0,0 +1,55 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_run_command_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vm_run_commands.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="myvmScaleSet", + instance_id="0", + run_command_name="myRunCommand", + run_command={ + "location": "West US", + "properties": { + "asyncExecution": False, + "errorBlobManagedIdentity": {}, + "errorBlobUri": "https://mystorageaccount.blob.core.windows.net/mycontainer/MyScriptError.txt", + "outputBlobManagedIdentity": {"clientId": "22d35efb-0c99-4041-8c5b-6d24db33a69a"}, + "outputBlobUri": "https://mystorageaccount.blob.core.windows.net/myscriptoutputcontainer/MyScriptoutput.txt", + "parameters": [{"name": "param1", "value": "value1"}, {"name": "param2", "value": "value2"}], + "runAsPassword": "", + "runAsUser": "user1", + "source": { + "scriptUri": "https://mystorageaccount.blob.core.windows.net/scriptcontainer/MyScript.ps1", + "scriptUriManagedIdentity": {"objectId": "4231e4d2-33e4-4e23-96b2-17888afa6072"}, + }, + "timeoutInSeconds": 3600, + "treatFailureAsDeploymentFailure": True, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Delete.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Delete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Delete.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Delete.py new file mode 100644 index 00000000000..b941e713c5b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Delete.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_run_command_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vm_run_commands.begin_delete( + resource_group_name="myResourceGroup", + vm_scale_set_name="myvmScaleSet", + instance_id="0", + run_command_name="myRunCommand", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Delete.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Get.py new file mode 100644 index 00000000000..3516b1f0e68 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Get.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_run_command_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vm_run_commands.get( + resource_group_name="myResourceGroup", + vm_scale_set_name="myvmScaleSet", + instance_id="0", + run_command_name="myRunCommand", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_List.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_List.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_List.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_List.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_List.py new file mode 100644 index 00000000000..eab48a5b459 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_List.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_run_command_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vm_run_commands.list( + resource_group_name="myResourceGroup", + vm_scale_set_name="myvmScaleSet", + instance_id="0", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_List.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Update.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Update.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Update.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Update.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Update.py new file mode 100644 index 00000000000..bc48af2956e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Update.py @@ -0,0 +1,44 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_run_command_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vm_run_commands.begin_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="myvmScaleSet", + instance_id="0", + run_command_name="myRunCommand", + run_command={ + "properties": { + "source": { + "scriptUri": "https://mystorageaccount.blob.core.windows.net/scriptcontainer/MyScript.ps1", + "scriptUriManagedIdentity": {"objectId": "4231e4d2-33e4-4e23-96b2-17888afa6072"}, + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/runCommandExamples/VirtualMachineScaleSetVMRunCommand_Update.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Create.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Create.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Create.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Create.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Create.py new file mode 100644 index 00000000000..069159732ba --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Create.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python ssh_public_key_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.ssh_public_keys.create( + resource_group_name="myResourceGroup", + ssh_public_key_name="mySshPublicKeyName", + parameters={"location": "westus", "properties": {"publicKey": "{ssh-rsa public key}"}}, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_Create.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Delete_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Delete_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Delete_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Delete_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Delete_MaximumSet_Gen.py new file mode 100644 index 00000000000..d78d4b46c4a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Delete_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python ssh_public_key_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.ssh_public_keys.delete( + resource_group_name="rgcompute", + ssh_public_key_name="aaaaaaaaaa", + ) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Delete_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Delete_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Delete_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Delete_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Delete_MinimumSet_Gen.py new file mode 100644 index 00000000000..17569a8f036 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Delete_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python ssh_public_key_delete_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.ssh_public_keys.delete( + resource_group_name="rgcompute", + ssh_public_key_name="aaaaaaaaaaaaaaaaaaa", + ) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_Delete_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair.py new file mode 100644 index 00000000000..67414bc39a3 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python ssh_public_key_generate_key_pair.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.ssh_public_keys.generate_key_pair( + resource_group_name="myResourceGroup", + ssh_public_key_name="mySshPublicKeyName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithEd25519.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithEd25519.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithEd25519.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithEd25519.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithEd25519.py new file mode 100644 index 00000000000..066b3ee2d98 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithEd25519.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python ssh_public_key_generate_key_pair_encryption_with_ed25519.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.ssh_public_keys.generate_key_pair( + resource_group_name="myResourceGroup", + ssh_public_key_name="mySshPublicKeyName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithEd25519.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithRSA.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithRSA.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithRSA.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithRSA.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithRSA.py new file mode 100644 index 00000000000..2efba94f2da --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithRSA.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python ssh_public_key_generate_key_pair_encryption_with_rsa.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.ssh_public_keys.generate_key_pair( + resource_group_name="myResourceGroup", + ssh_public_key_name="mySshPublicKeyName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_GenerateKeyPair_EncryptionWithRSA.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Get.py new file mode 100644 index 00000000000..eb8fd7bcc4d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python ssh_public_key_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.ssh_public_keys.get( + resource_group_name="myResourceGroup", + ssh_public_key_name="mySshPublicKeyName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MaximumSet_Gen.py new file mode 100644 index 00000000000..1b2b82931e8 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python ssh_public_key_list_by_resource_group_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.ssh_public_keys.list_by_resource_group( + resource_group_name="rgcompute", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MinimumSet_Gen.py new file mode 100644 index 00000000000..f7aebb29981 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python ssh_public_key_list_by_resource_group_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.ssh_public_keys.list_by_resource_group( + resource_group_name="rgcompute", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_ListByResourceGroup_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MaximumSet_Gen.py new file mode 100644 index 00000000000..eb7063e92f5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MaximumSet_Gen.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python ssh_public_key_list_by_subscription_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.ssh_public_keys.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MinimumSet_Gen.py new file mode 100644 index 00000000000..dfdf6a388f5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MinimumSet_Gen.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python ssh_public_key_list_by_subscription_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.ssh_public_keys.list_by_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_ListBySubscription_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Update_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Update_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Update_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Update_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Update_MaximumSet_Gen.py new file mode 100644 index 00000000000..41e5c37f303 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/sshPublicKeyExamples/SshPublicKey_Update_MaximumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python ssh_public_key_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.ssh_public_keys.update( + resource_group_name="rgcompute", + ssh_public_key_name="aaaaaaaaaaaa", + parameters={"properties": {"publicKey": "{ssh-rsa public key}"}, "tags": {"key2854": "a"}}, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/sshPublicKeyExamples/SshPublicKey_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MaximumSet_Gen.py new file mode 100644 index 00000000000..0f8d11a1a9d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MaximumSet_Gen.py @@ -0,0 +1,73 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_extension_create_or_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_extensions.begin_create_or_update( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaaaaaaaaaaaaaaaa", + vm_extension_name="aaaaaaaaaaaaa", + extension_parameters={ + "location": "westus", + "properties": { + "autoUpgradeMinorVersion": True, + "enableAutomaticUpgrade": True, + "forceUpdateTag": "a", + "instanceView": { + "name": "aaaaaaaaaaaaaaaaa", + "statuses": [ + { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z", + } + ], + "substatuses": [ + { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z", + } + ], + "type": "aaaaaaaaa", + "typeHandlerVersion": "aaaaaaaaaaaaaaaaaaaaaaaaaa", + }, + "protectedSettings": {}, + "publisher": "extPublisher", + "settings": {}, + "suppressFailures": True, + "type": "extType", + "typeHandlerVersion": "1.2", + }, + "tags": {"key9183": "aa"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MinimumSet_Gen.py new file mode 100644 index 00000000000..7348c184d1f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MinimumSet_Gen.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_extension_create_or_update_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_extensions.begin_create_or_update( + resource_group_name="rgcompute", + vm_name="myVM", + vm_extension_name="myVMExtension", + extension_parameters={"location": "westus"}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_CreateOrUpdate_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Delete_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Delete_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Delete_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Delete_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Delete_MaximumSet_Gen.py new file mode 100644 index 00000000000..283d993b4cd --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Delete_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_extension_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_extensions.begin_delete( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaaaaa", + vm_extension_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Delete_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Delete_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Delete_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Delete_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Delete_MinimumSet_Gen.py new file mode 100644 index 00000000000..72a5a55968f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Delete_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_extension_delete_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_extensions.begin_delete( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaaaaaaaaaaaaaaaaa", + vm_extension_name="aa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_Delete_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Get_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Get_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Get_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Get_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Get_MaximumSet_Gen.py new file mode 100644 index 00000000000..2e9f3e60e97 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Get_MaximumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_extension_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_extensions.get( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + vm_extension_name="aaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Get_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Get_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Get_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Get_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Get_MinimumSet_Gen.py new file mode 100644 index 00000000000..12f8e6d87ed --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Get_MinimumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_extension_get_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_extensions.get( + resource_group_name="rgcompute", + vm_name="myVM", + vm_extension_name="myVMExtension", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_Get_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_List_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_List_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_List_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_List_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_List_MaximumSet_Gen.py new file mode 100644 index 00000000000..aa1c61ffbf2 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_List_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_extension_list_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_extensions.list( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_List_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_List_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_List_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_List_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_List_MinimumSet_Gen.py new file mode 100644 index 00000000000..e9cb2f15318 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_List_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_extension_list_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_extensions.list( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_List_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Update.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Update.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Update.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Update.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Update.py new file mode 100644 index 00000000000..f81aa5ea277 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachineExtension_Update.py @@ -0,0 +1,51 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_extension_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_extensions.begin_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + vm_extension_name="myVMExtension", + extension_parameters={ + "properties": { + "autoUpgradeMinorVersion": True, + "protectedSettingsFromKeyVault": { + "secretUrl": "https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e", + "sourceVault": { + "id": "/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName" + }, + }, + "publisher": "extPublisher", + "settings": {"UserName": "xyz@microsoft.com"}, + "suppressFailures": True, + "type": "extType", + "typeHandlerVersion": "1.2", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachineExtension_Update.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AssessPatches.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AssessPatches.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AssessPatches.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AssessPatches.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AssessPatches.py new file mode 100644 index 00000000000..fc01c6c760a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AssessPatches.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_assess_patches.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_assess_patches( + resource_group_name="myResourceGroupName", + vm_name="myVMName", + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_AssessPatches.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MaximumSet_Gen.py new file mode 100644 index 00000000000..a063220baca --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MaximumSet_Gen.py @@ -0,0 +1,68 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_attach_detach_data_disks_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_attach_detach_data_disks( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaaaaaaaaaaaa", + parameters={ + "dataDisksToAttach": [ + { + "caching": "ReadOnly", + "deleteOption": "Delete", + "diskEncryptionSet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d", + "lun": 1, + "writeAcceleratorEnabled": True, + }, + { + "caching": "ReadWrite", + "deleteOption": "Detach", + "diskEncryptionSet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_2_disk3_7d5e664bdafa49baa780eb2d128ff38e", + "lun": 2, + "writeAcceleratorEnabled": False, + }, + ], + "dataDisksToDetach": [ + { + "detachOption": "ForceDetach", + "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x", + }, + { + "detachOption": "ForceDetach", + "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_4_disk4_4d4e784bdafa49baa780eb2d256ff41z", + }, + ], + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MinimumSet_Gen.py new file mode 100644 index 00000000000..c39fe2a26a4 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MinimumSet_Gen.py @@ -0,0 +1,46 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_attach_detach_data_disks_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_attach_detach_data_disks( + resource_group_name="rgcompute", + vm_name="azure-vm", + parameters={ + "dataDisksToAttach": [ + { + "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d" + } + ], + "dataDisksToDetach": [ + { + "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x" + } + ], + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_AttachDetachDataDisks_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Capture_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Capture_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Capture_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Capture_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Capture_MaximumSet_Gen.py new file mode 100644 index 00000000000..54a27cfac2a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Capture_MaximumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_capture_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_capture( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaaaaaaaaaaaa", + parameters={"destinationContainerName": "aaaaaaa", "overwriteVhds": True, "vhdPrefix": "aaaaaaaaa"}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Capture_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Capture_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Capture_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Capture_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Capture_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Capture_MinimumSet_Gen.py new file mode 100644 index 00000000000..b1de31871f1 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Capture_MinimumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_capture_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_capture( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaaaaa", + parameters={"destinationContainerName": "aaaaaaa", "overwriteVhds": True, "vhdPrefix": "aaaaaaaaa"}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Capture_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MaximumSet_Gen.py new file mode 100644 index 00000000000..b8a1d990246 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_convert_to_managed_disks_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_convert_to_managed_disks( + resource_group_name="rgcompute", + vm_name="aaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MinimumSet_Gen.py new file mode 100644 index 00000000000..b726fd3cc85 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_convert_to_managed_disks_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_convert_to_managed_disks( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_ConvertToManagedDisks_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_CustomImageVmFromAnUnmanagedGeneralizedOsImage.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_CustomImageVmFromAnUnmanagedGeneralizedOsImage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_CustomImageVmFromAnUnmanagedGeneralizedOsImage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_CustomImageVmFromAnUnmanagedGeneralizedOsImage.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_CustomImageVmFromAnUnmanagedGeneralizedOsImage.py new file mode 100644 index 00000000000..5e277bf230d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_CustomImageVmFromAnUnmanagedGeneralizedOsImage.py @@ -0,0 +1,67 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_custom_image_vm_from_an_unmanaged_generalized_os_image.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="{vm-name}", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "image": { + "uri": "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd" + }, + "name": "myVMosdisk", + "osType": "Windows", + "vhd": { + "uri": "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd" + }, + } + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_CustomImageVmFromAnUnmanagedGeneralizedOsImage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromACommunityGalleryImage.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromACommunityGalleryImage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromACommunityGalleryImage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromACommunityGalleryImage.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromACommunityGalleryImage.py new file mode 100644 index 00000000000..5c94f5e458e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromACommunityGalleryImage.py @@ -0,0 +1,64 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_from_acommunity_gallery_image.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "communityGalleryImageId": "/CommunityGalleries/galleryPublicName/Images/communityGalleryImageName/Versions/communityGalleryImageVersionName" + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_FromACommunityGalleryImage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromACustomImage.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromACustomImage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromACustomImage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromACustomImage.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromACustomImage.py new file mode 100644 index 00000000000..15e108378d8 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromACustomImage.py @@ -0,0 +1,64 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_from_acustom_image.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_FromACustomImage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromAGeneralizedSharedImage.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromAGeneralizedSharedImage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromAGeneralizedSharedImage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromAGeneralizedSharedImage.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromAGeneralizedSharedImage.py new file mode 100644 index 00000000000..5545cb57836 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromAGeneralizedSharedImage.py @@ -0,0 +1,64 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_from_ageneralized_shared_image.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage" + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_FromAGeneralizedSharedImage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromASharedGalleryImage.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromASharedGalleryImage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromASharedGalleryImage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromASharedGalleryImage.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromASharedGalleryImage.py new file mode 100644 index 00000000000..6c21ffae1ce --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromASharedGalleryImage.py @@ -0,0 +1,64 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_from_ashared_gallery_image.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "sharedGalleryImageId": "/SharedGalleries/sharedGalleryName/Images/sharedGalleryImageName/Versions/sharedGalleryImageVersionName" + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_FromASharedGalleryImage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromASpecializedSharedImage.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromASpecializedSharedImage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromASpecializedSharedImage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromASpecializedSharedImage.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromASpecializedSharedImage.py new file mode 100644 index 00000000000..ad0de83f418 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_FromASpecializedSharedImage.py @@ -0,0 +1,59 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_from_aspecialized_shared_image.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "storageProfile": { + "imageReference": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage" + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_FromASpecializedSharedImage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_InAVmssWithCustomerAssignedPlatformFaultDomain.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_InAVmssWithCustomerAssignedPlatformFaultDomain.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_InAVmssWithCustomerAssignedPlatformFaultDomain.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_InAVmssWithCustomerAssignedPlatformFaultDomain.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_InAVmssWithCustomerAssignedPlatformFaultDomain.py new file mode 100644 index 00000000000..33c3d6a3e5b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_InAVmssWithCustomerAssignedPlatformFaultDomain.py @@ -0,0 +1,71 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_in_avmss_with_customer_assigned_platform_fault_domain.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "platformFaultDomain": 1, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + "virtualMachineScaleSet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{existing-flex-vmss-name-with-platformFaultDomainCount-greater-than-1}" + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_InAVmssWithCustomerAssignedPlatformFaultDomain.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_InAnAvailabilitySet.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_InAnAvailabilitySet.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_InAnAvailabilitySet.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_InAnAvailabilitySet.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_InAnAvailabilitySet.py new file mode 100644 index 00000000000..61522df8ada --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_InAnAvailabilitySet.py @@ -0,0 +1,70 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_in_an_availability_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "availabilitySet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/{existing-availability-set-name}" + }, + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_InAnAvailabilitySet.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithAutomaticByPlatformSettings.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithAutomaticByPlatformSettings.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithAutomaticByPlatformSettings.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithAutomaticByPlatformSettings.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithAutomaticByPlatformSettings.py new file mode 100644 index 00000000000..b0f68f84f30 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithAutomaticByPlatformSettings.py @@ -0,0 +1,78 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_linux_vm_with_automatic_by_platform_settings.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D2s_v3"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + "linuxConfiguration": { + "patchSettings": { + "assessmentMode": "AutomaticByPlatform", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": True, + "rebootSetting": "Never", + }, + "patchMode": "AutomaticByPlatform", + }, + "provisionVMAgent": True, + }, + }, + "storageProfile": { + "imageReference": { + "offer": "UbuntuServer", + "publisher": "Canonical", + "sku": "16.04-LTS", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Premium_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithAutomaticByPlatformSettings.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingAssessmentModeOfImageDefault.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingAssessmentModeOfImageDefault.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingAssessmentModeOfImageDefault.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingAssessmentModeOfImageDefault.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingAssessmentModeOfImageDefault.py new file mode 100644 index 00000000000..efc07319f2a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingAssessmentModeOfImageDefault.py @@ -0,0 +1,71 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_linux_vm_with_patch_setting_assessment_mode_of_image_default.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D2s_v3"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + "linuxConfiguration": { + "patchSettings": {"assessmentMode": "ImageDefault"}, + "provisionVMAgent": True, + }, + }, + "storageProfile": { + "imageReference": { + "offer": "UbuntuServer", + "publisher": "Canonical", + "sku": "16.04-LTS", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Premium_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingAssessmentModeOfImageDefault.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModeOfImageDefault.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModeOfImageDefault.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModeOfImageDefault.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModeOfImageDefault.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModeOfImageDefault.py new file mode 100644 index 00000000000..4c26cdbf133 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModeOfImageDefault.py @@ -0,0 +1,68 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_linux_vm_with_patch_setting_mode_of_image_default.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D2s_v3"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + "linuxConfiguration": {"patchSettings": {"patchMode": "ImageDefault"}, "provisionVMAgent": True}, + }, + "storageProfile": { + "imageReference": { + "offer": "UbuntuServer", + "publisher": "Canonical", + "sku": "16.04-LTS", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Premium_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModeOfImageDefault.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModesOfAutomaticByPlatform.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModesOfAutomaticByPlatform.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModesOfAutomaticByPlatform.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModesOfAutomaticByPlatform.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModesOfAutomaticByPlatform.py new file mode 100644 index 00000000000..845f5522b6a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModesOfAutomaticByPlatform.py @@ -0,0 +1,71 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_linux_vm_with_patch_setting_modes_of_automatic_by_platform.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D2s_v3"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + "linuxConfiguration": { + "patchSettings": {"assessmentMode": "AutomaticByPlatform", "patchMode": "AutomaticByPlatform"}, + "provisionVMAgent": True, + }, + }, + "storageProfile": { + "imageReference": { + "offer": "UbuntuServer", + "publisher": "Canonical", + "sku": "16.04-LTS", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Premium_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_LinuxVmWithPatchSettingModesOfAutomaticByPlatform.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_PlatformImageVmWithUnmanagedOsAndDataDisks.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_PlatformImageVmWithUnmanagedOsAndDataDisks.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_PlatformImageVmWithUnmanagedOsAndDataDisks.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_PlatformImageVmWithUnmanagedOsAndDataDisks.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_PlatformImageVmWithUnmanagedOsAndDataDisks.py new file mode 100644 index 00000000000..c6322acd470 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_PlatformImageVmWithUnmanagedOsAndDataDisks.py @@ -0,0 +1,87 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_platform_image_vm_with_unmanaged_os_and_data_disks.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="{vm-name}", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D2_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "dataDisks": [ + { + "createOption": "Empty", + "diskSizeGB": 1023, + "lun": 0, + "vhd": { + "uri": "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk0.vhd" + }, + }, + { + "createOption": "Empty", + "diskSizeGB": 1023, + "lun": 1, + "vhd": { + "uri": "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk1.vhd" + }, + }, + ], + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "name": "myVMosdisk", + "vhd": { + "uri": "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd" + }, + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_PlatformImageVmWithUnmanagedOsAndDataDisks.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithAutomaticByPlatformSettings.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithAutomaticByPlatformSettings.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithAutomaticByPlatformSettings.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithAutomaticByPlatformSettings.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithAutomaticByPlatformSettings.py new file mode 100644 index 00000000000..ed274e1e451 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithAutomaticByPlatformSettings.py @@ -0,0 +1,79 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_windows_vm_with_automatic_by_platform_settings.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + "windowsConfiguration": { + "enableAutomaticUpdates": True, + "patchSettings": { + "assessmentMode": "AutomaticByPlatform", + "automaticByPlatformSettings": { + "bypassPlatformSafetyChecksOnUserSchedule": False, + "rebootSetting": "Never", + }, + "patchMode": "AutomaticByPlatform", + }, + "provisionVMAgent": True, + }, + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Premium_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithAutomaticByPlatformSettings.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingAssessmentModeOfImageDefault.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingAssessmentModeOfImageDefault.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingAssessmentModeOfImageDefault.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingAssessmentModeOfImageDefault.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingAssessmentModeOfImageDefault.py new file mode 100644 index 00000000000..a3ee5364d47 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingAssessmentModeOfImageDefault.py @@ -0,0 +1,72 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_windows_vm_with_patch_setting_assessment_mode_of_image_default.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + "windowsConfiguration": { + "enableAutomaticUpdates": True, + "patchSettings": {"assessmentMode": "ImageDefault"}, + "provisionVMAgent": True, + }, + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Premium_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingAssessmentModeOfImageDefault.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByOS.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByOS.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByOS.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByOS.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByOS.py new file mode 100644 index 00000000000..81714f70d5b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByOS.py @@ -0,0 +1,72 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_os.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/nsgExistingNic", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + "windowsConfiguration": { + "enableAutomaticUpdates": True, + "patchSettings": {"patchMode": "AutomaticByOS"}, + "provisionVMAgent": True, + }, + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Premium_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByOS.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByPlatformAndEnableHotPatchingTrue.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByPlatformAndEnableHotPatchingTrue.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByPlatformAndEnableHotPatchingTrue.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByPlatformAndEnableHotPatchingTrue.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByPlatformAndEnableHotPatchingTrue.py new file mode 100644 index 00000000000..a6284f4ee14 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByPlatformAndEnableHotPatchingTrue.py @@ -0,0 +1,72 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_windows_vm_with_patch_setting_mode_of_automatic_by_platform_and_enable_hot_patching_true.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + "windowsConfiguration": { + "enableAutomaticUpdates": True, + "patchSettings": {"enableHotpatching": True, "patchMode": "AutomaticByPlatform"}, + "provisionVMAgent": True, + }, + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Premium_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfAutomaticByPlatformAndEnableHotPatchingTrue.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfManual.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfManual.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfManual.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfManual.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfManual.py new file mode 100644 index 00000000000..72fe9b580aa --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfManual.py @@ -0,0 +1,72 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_windows_vm_with_patch_setting_mode_of_manual.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + "windowsConfiguration": { + "enableAutomaticUpdates": True, + "patchSettings": {"patchMode": "Manual"}, + "provisionVMAgent": True, + }, + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Premium_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModeOfManual.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModesOfAutomaticByPlatform.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModesOfAutomaticByPlatform.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModesOfAutomaticByPlatform.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModesOfAutomaticByPlatform.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModesOfAutomaticByPlatform.py new file mode 100644 index 00000000000..3ca31d59fc8 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModesOfAutomaticByPlatform.py @@ -0,0 +1,72 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_windows_vm_with_patch_setting_modes_of_automatic_by_platform.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + "windowsConfiguration": { + "enableAutomaticUpdates": True, + "patchSettings": {"assessmentMode": "AutomaticByPlatform", "patchMode": "AutomaticByPlatform"}, + "provisionVMAgent": True, + }, + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Premium_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WindowsVmWithPatchSettingModesOfAutomaticByPlatform.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDisk.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDisk.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDisk.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDisk.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDisk.py new file mode 100644 index 00000000000..6bc8ef2cadd --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDisk.py @@ -0,0 +1,69 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_adiff_os_disk.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, + "properties": { + "hardwareProfile": {"vmSize": "Standard_DS1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "offer": "windows-data-science-vm", + "publisher": "microsoft-ads", + "sku": "windows2016", + "version": "latest", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "diffDiskSettings": {"option": "Local"}, + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDisk.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsCacheDisk.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsCacheDisk.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsCacheDisk.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsCacheDisk.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsCacheDisk.py new file mode 100644 index 00000000000..1633dd0c154 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsCacheDisk.py @@ -0,0 +1,69 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_cache_disk.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, + "properties": { + "hardwareProfile": {"vmSize": "Standard_DS1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "offer": "windows-data-science-vm", + "publisher": "microsoft-ads", + "sku": "windows2016", + "version": "latest", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "diffDiskSettings": {"option": "Local", "placement": "CacheDisk"}, + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsCacheDisk.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsNvmeDisk.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsNvmeDisk.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsNvmeDisk.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsNvmeDisk.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsNvmeDisk.py new file mode 100644 index 00000000000..e30a20294c0 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsNvmeDisk.py @@ -0,0 +1,69 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_nvme_disk.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, + "properties": { + "hardwareProfile": {"vmSize": "Standard_DS1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "offer": "windows-data-science-vm", + "publisher": "microsoft-ads", + "sku": "windows2016", + "version": "latest", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "diffDiskSettings": {"option": "Local", "placement": "NvmeDisk"}, + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsNvmeDisk.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsResourceDisk.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsResourceDisk.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsResourceDisk.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsResourceDisk.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsResourceDisk.py new file mode 100644 index 00000000000..022c9650a9d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsResourceDisk.py @@ -0,0 +1,69 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_adiff_os_disk_using_diff_disk_placement_as_resource_disk.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, + "properties": { + "hardwareProfile": {"vmSize": "Standard_DS1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "offer": "windows-data-science-vm", + "publisher": "microsoft-ads", + "sku": "windows2016", + "version": "latest", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "diffDiskSettings": {"option": "Local", "placement": "ResourceDisk"}, + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithADiffOsDiskUsingDiffDiskPlacementAsResourceDisk.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithAMarketplaceImagePlan.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithAMarketplaceImagePlan.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithAMarketplaceImagePlan.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithAMarketplaceImagePlan.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithAMarketplaceImagePlan.py new file mode 100644 index 00000000000..c9b5e1c8475 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithAMarketplaceImagePlan.py @@ -0,0 +1,68 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_amarketplace_image_plan.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "offer": "windows-data-science-vm", + "publisher": "microsoft-ads", + "sku": "windows2016", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithAMarketplaceImagePlan.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithApplicationProfile.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithApplicationProfile.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithApplicationProfile.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithApplicationProfile.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithApplicationProfile.py new file mode 100644 index 00000000000..f9b1809e06f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithApplicationProfile.py @@ -0,0 +1,82 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_application_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "applicationProfile": { + "galleryApplications": [ + { + "configurationReference": "https://mystorageaccount.blob.core.windows.net/configurations/settings.config", + "enableAutomaticUpgrade": False, + "order": 1, + "packageReferenceId": "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0", + "tags": "myTag1", + "treatFailureAsDeploymentFailure": False, + }, + { + "packageReferenceId": "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1" + }, + ] + }, + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "offer": "{image_offer}", + "publisher": "{image_publisher}", + "sku": "{image_sku}", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithApplicationProfile.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithBootDiagnostics.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithBootDiagnostics.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithBootDiagnostics.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithBootDiagnostics.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithBootDiagnostics.py new file mode 100644 index 00000000000..fb4a9f65394 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithBootDiagnostics.py @@ -0,0 +1,73 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_boot_diagnostics.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": True, + "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", + } + }, + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithBootDiagnostics.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithCapacityReservation.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithCapacityReservation.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithCapacityReservation.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithCapacityReservation.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithCapacityReservation.py new file mode 100644 index 00000000000..beb5980a227 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithCapacityReservation.py @@ -0,0 +1,73 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_capacity_reservation.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, + "properties": { + "capacityReservation": { + "capacityReservationGroup": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}" + } + }, + "hardwareProfile": {"vmSize": "Standard_DS1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "offer": "windows-data-science-vm", + "publisher": "microsoft-ads", + "sku": "windows2016", + "version": "latest", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithCapacityReservation.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDataDisksFromSourceResource.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDataDisksFromSourceResource.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDataDisksFromSourceResource.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDataDisksFromSourceResource.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDataDisksFromSourceResource.py new file mode 100644 index 00000000000..a61e4d698f3 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDataDisksFromSourceResource.py @@ -0,0 +1,93 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_data_disks_from_source_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D2_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "dataDisks": [ + { + "createOption": "Copy", + "diskSizeGB": 1023, + "lun": 0, + "sourceResource": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/{existing-snapshot-name}" + }, + }, + { + "createOption": "Copy", + "diskSizeGB": 1023, + "lun": 1, + "sourceResource": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/{existing-disk-name}" + }, + }, + { + "createOption": "Restore", + "diskSizeGB": 1023, + "lun": 2, + "sourceResource": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/restorePointCollections/{existing-rpc-name}/restorePoints/{existing-rp-name}/diskRestorePoints/{existing-disk-restore-point-name}" + }, + }, + ], + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithDataDisksFromSourceResource.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDiskControllerType.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDiskControllerType.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDiskControllerType.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDiskControllerType.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDiskControllerType.py new file mode 100644 index 00000000000..df61aa50799 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDiskControllerType.py @@ -0,0 +1,83 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_disk_controller_type.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": True, + "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", + } + }, + "hardwareProfile": {"vmSize": "Standard_D4_v3"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "scheduledEventsPolicy": { + "allInstancesDown": {"automaticallyApprove": True}, + "scheduledEventsAdditionalPublishingTargets": { + "eventGridAndResourceGraph": {"enable": True, "scheduledEventsApiVersion": "2020-07-01"} + }, + "userInitiatedReboot": {"automaticallyApprove": True}, + "userInitiatedRedeploy": {"automaticallyApprove": True}, + }, + "storageProfile": { + "diskControllerType": "NVMe", + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + "userData": "U29tZSBDdXN0b20gRGF0YQ==", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithDiskControllerType.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDiskEncryptionSetResource.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDiskEncryptionSetResource.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDiskEncryptionSetResource.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDiskEncryptionSetResource.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDiskEncryptionSetResource.py new file mode 100644 index 00000000000..3b14adf556f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithDiskEncryptionSetResource.py @@ -0,0 +1,96 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_disk_encryption_set_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "dataDisks": [ + { + "caching": "ReadWrite", + "createOption": "Empty", + "diskSizeGB": 1023, + "lun": 0, + "managedDisk": { + "diskEncryptionSet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + "storageAccountType": "Standard_LRS", + }, + }, + { + "caching": "ReadWrite", + "createOption": "Attach", + "diskSizeGB": 1023, + "lun": 1, + "managedDisk": { + "diskEncryptionSet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/{existing-managed-disk-name}", + "storageAccountType": "Standard_LRS", + }, + }, + ], + "imageReference": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": { + "diskEncryptionSet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + "storageAccountType": "Standard_LRS", + }, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithDiskEncryptionSetResource.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEmptyDataDisks.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEmptyDataDisks.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEmptyDataDisks.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEmptyDataDisks.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEmptyDataDisks.py new file mode 100644 index 00000000000..3a59521e2aa --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEmptyDataDisks.py @@ -0,0 +1,71 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_empty_data_disks.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D2_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "dataDisks": [ + {"createOption": "Empty", "diskSizeGB": 1023, "lun": 0}, + {"createOption": "Empty", "diskSizeGB": 1023, "lun": 1}, + ], + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithEmptyDataDisks.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEncryptionAtHost.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEncryptionAtHost.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEncryptionAtHost.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEncryptionAtHost.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEncryptionAtHost.py new file mode 100644 index 00000000000..13614472c77 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEncryptionAtHost.py @@ -0,0 +1,69 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_encryption_at_host.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, + "properties": { + "hardwareProfile": {"vmSize": "Standard_DS1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "securityProfile": {"encryptionAtHost": True}, + "storageProfile": { + "imageReference": { + "offer": "windows-data-science-vm", + "publisher": "microsoft-ads", + "sku": "windows2016", + "version": "latest", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithEncryptionAtHost.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEncryptionIdentity.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEncryptionIdentity.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEncryptionIdentity.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEncryptionIdentity.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEncryptionIdentity.py new file mode 100644 index 00000000000..9298f8aa192 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithEncryptionIdentity.py @@ -0,0 +1,78 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_encryption_identity.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": {} + }, + }, + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D2s_v3"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "securityProfile": { + "encryptionIdentity": { + "userAssignedIdentityResourceId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity" + } + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2019-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "StandardSSD_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithEncryptionIdentity.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithExtensionsTimeBudget.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithExtensionsTimeBudget.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithExtensionsTimeBudget.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithExtensionsTimeBudget.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithExtensionsTimeBudget.py new file mode 100644 index 00000000000..03ecaee01f0 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithExtensionsTimeBudget.py @@ -0,0 +1,74 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_extensions_time_budget.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": True, + "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", + } + }, + "extensionsTimeBudget": "PT30M", + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithExtensionsTimeBudget.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithHibernationEnabled.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithHibernationEnabled.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithHibernationEnabled.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithHibernationEnabled.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithHibernationEnabled.py new file mode 100644 index 00000000000..e94b6047692 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithHibernationEnabled.py @@ -0,0 +1,74 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_hibernation_enabled.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="{vm-name}", + parameters={ + "location": "eastus2euap", + "properties": { + "additionalCapabilities": {"hibernationEnabled": True}, + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": True, + "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", + } + }, + "hardwareProfile": {"vmSize": "Standard_D2s_v3"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "{vm-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2019-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "vmOSdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithHibernationEnabled.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithManagedBootDiagnostics.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithManagedBootDiagnostics.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithManagedBootDiagnostics.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithManagedBootDiagnostics.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithManagedBootDiagnostics.py new file mode 100644 index 00000000000..fe592ccbf71 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithManagedBootDiagnostics.py @@ -0,0 +1,68 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_managed_boot_diagnostics.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "diagnosticsProfile": {"bootDiagnostics": {"enabled": True}}, + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithManagedBootDiagnostics.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfiguration.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfiguration.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfiguration.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfiguration.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfiguration.py new file mode 100644 index 00000000000..8cc4d6c65f7 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfiguration.py @@ -0,0 +1,89 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_network_interface_configuration.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkApiVersion": "2020-11-01", + "networkInterfaceConfigurations": [ + { + "name": "{nic-config-name}", + "properties": { + "deleteOption": "Delete", + "ipConfigurations": [ + { + "name": "{ip-config-name}", + "properties": { + "primary": True, + "publicIPAddressConfiguration": { + "name": "{publicIP-config-name}", + "properties": { + "deleteOption": "Detach", + "publicIPAllocationMethod": "Static", + }, + "sku": {"name": "Basic", "tier": "Global"}, + "tags": {"pipTag": "tag"}, + }, + }, + } + ], + "primary": True, + }, + "tags": {"nicTag": "tag"}, + } + ], + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfiguration.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfigurationDnsSettings.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfigurationDnsSettings.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfigurationDnsSettings.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfigurationDnsSettings.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfigurationDnsSettings.py new file mode 100644 index 00000000000..6bd307115ab --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfigurationDnsSettings.py @@ -0,0 +1,91 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_network_interface_configuration_dns_settings.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkApiVersion": "2020-11-01", + "networkInterfaceConfigurations": [ + { + "name": "{nic-config-name}", + "properties": { + "deleteOption": "Delete", + "ipConfigurations": [ + { + "name": "{ip-config-name}", + "properties": { + "primary": True, + "publicIPAddressConfiguration": { + "name": "{publicIP-config-name}", + "properties": { + "deleteOption": "Detach", + "dnsSettings": { + "domainNameLabel": "aaaaa", + "domainNameLabelScope": "TenantReuse", + }, + "publicIPAllocationMethod": "Static", + }, + "sku": {"name": "Basic", "tier": "Global"}, + }, + }, + } + ], + "primary": True, + }, + } + ], + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithNetworkInterfaceConfigurationDnsSettings.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPasswordAuthentication.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPasswordAuthentication.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPasswordAuthentication.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPasswordAuthentication.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPasswordAuthentication.py new file mode 100644 index 00000000000..5e3220ec930 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPasswordAuthentication.py @@ -0,0 +1,67 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_password_authentication.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithPasswordAuthentication.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPlacement.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPlacement.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPlacement.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPlacement.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPlacement.py new file mode 100644 index 00000000000..5b8f8193d4c --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPlacement.py @@ -0,0 +1,69 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_placement.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus2", + "placement": {"includeZones": ["1", "3"], "zonePlacementPolicy": "Any"}, + "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, + "properties": { + "hardwareProfile": {"vmSize": "Standard_DS1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "offer": "windows-data-science-vm", + "publisher": "microsoft-ads", + "sku": "windows2016", + "version": "latest", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithPlacement.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPremiumStorage.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPremiumStorage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPremiumStorage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPremiumStorage.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPremiumStorage.py new file mode 100644 index 00000000000..9223363d6a2 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithPremiumStorage.py @@ -0,0 +1,67 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_premium_storage.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Premium_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithPremiumStorage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithProxyAgentSettings.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithProxyAgentSettings.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithProxyAgentSettings.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithProxyAgentSettings.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithProxyAgentSettings.py new file mode 100644 index 00000000000..14a3035f4e7 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithProxyAgentSettings.py @@ -0,0 +1,70 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_proxy_agent_settings.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D2s_v3"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "securityProfile": { + "proxyAgentSettings": {"enabled": True, "imds": {"mode": "Audit"}, "wireServer": {"mode": "Audit"}} + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2019-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "StandardSSD_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithProxyAgentSettings.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithScheduledEventsProfile.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithScheduledEventsProfile.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithScheduledEventsProfile.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithScheduledEventsProfile.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithScheduledEventsProfile.py new file mode 100644 index 00000000000..bc5a3aad130 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithScheduledEventsProfile.py @@ -0,0 +1,85 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_scheduled_events_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": True, + "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", + } + }, + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "scheduledEventsPolicy": { + "allInstancesDown": {"automaticallyApprove": True}, + "scheduledEventsAdditionalPublishingTargets": { + "eventGridAndResourceGraph": {"enable": True, "scheduledEventsApiVersion": "2020-07-01"} + }, + "userInitiatedReboot": {"automaticallyApprove": True}, + "userInitiatedRedeploy": {"automaticallyApprove": True}, + }, + "scheduledEventsProfile": { + "osImageNotificationProfile": {"enable": True, "notBeforeTimeout": "PT15M"}, + "terminateNotificationProfile": {"enable": True, "notBeforeTimeout": "PT10M"}, + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithScheduledEventsProfile.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVM.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVM.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVM.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVM.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVM.py new file mode 100644 index 00000000000..47848c5b795 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVM.py @@ -0,0 +1,74 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_security_type_confidential_vm.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_DC2as_v5"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "securityProfile": { + "securityType": "ConfidentialVM", + "uefiSettings": {"secureBootEnabled": True, "vTpmEnabled": True}, + }, + "storageProfile": { + "imageReference": { + "offer": "2019-datacenter-cvm", + "publisher": "MicrosoftWindowsServer", + "sku": "windows-cvm", + "version": "17763.2183.2109130127", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "managedDisk": { + "securityProfile": {"securityEncryptionType": "DiskWithVMGuestState"}, + "storageAccountType": "StandardSSD_LRS", + }, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVM.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithCustomerManagedKeys.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithCustomerManagedKeys.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithCustomerManagedKeys.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithCustomerManagedKeys.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithCustomerManagedKeys.py new file mode 100644 index 00000000000..bfe8e800f95 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithCustomerManagedKeys.py @@ -0,0 +1,79 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_security_type_confidential_vm_with_customer_managed_keys.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_DC2as_v5"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "securityProfile": { + "securityType": "ConfidentialVM", + "uefiSettings": {"secureBootEnabled": True, "vTpmEnabled": True}, + }, + "storageProfile": { + "imageReference": { + "offer": "2019-datacenter-cvm", + "publisher": "MicrosoftWindowsServer", + "sku": "windows-cvm", + "version": "17763.2183.2109130127", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "managedDisk": { + "securityProfile": { + "diskEncryptionSet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + "securityEncryptionType": "DiskWithVMGuestState", + }, + "storageAccountType": "StandardSSD_LRS", + }, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithCustomerManagedKeys.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.py new file mode 100644 index 00000000000..70e83c7e812 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.py @@ -0,0 +1,74 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_security_type_confidential_vm_with_non_persisted_tpm.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_DC2es_v5"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "securityProfile": { + "securityType": "ConfidentialVM", + "uefiSettings": {"secureBootEnabled": False, "vTpmEnabled": True}, + }, + "storageProfile": { + "imageReference": { + "offer": "2022-datacenter-cvm", + "publisher": "UbuntuServer", + "sku": "linux-cvm", + "version": "17763.2183.2109130127", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "managedDisk": { + "securityProfile": {"securityEncryptionType": "NonPersistedTPM"}, + "storageAccountType": "StandardSSD_LRS", + }, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSshAuthentication.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSshAuthentication.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSshAuthentication.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSshAuthentication.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSshAuthentication.py new file mode 100644 index 00000000000..98c5af417dc --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithSshAuthentication.py @@ -0,0 +1,77 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_ssh_authentication.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminUsername": "{your-username}", + "computerName": "myVM", + "linuxConfiguration": { + "disablePasswordAuthentication": True, + "ssh": { + "publicKeys": [ + { + "keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1", + "path": "/home/{your-username}/.ssh/authorized_keys", + } + ] + }, + }, + }, + "storageProfile": { + "imageReference": { + "offer": "{image_offer}", + "publisher": "{image_publisher}", + "sku": "{image_sku}", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithSshAuthentication.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithUefiSettings.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithUefiSettings.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithUefiSettings.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithUefiSettings.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithUefiSettings.py new file mode 100644 index 00000000000..4974e4c91e7 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithUefiSettings.py @@ -0,0 +1,71 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_uefi_settings.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "hardwareProfile": {"vmSize": "Standard_D2s_v3"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "securityProfile": { + "securityType": "TrustedLaunch", + "uefiSettings": {"secureBootEnabled": True, "vTpmEnabled": True}, + }, + "storageProfile": { + "imageReference": { + "offer": "windowsserver-gen2preview-preview", + "publisher": "MicrosoftWindowsServer", + "sku": "windows10-tvm", + "version": "18363.592.2001092016", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "StandardSSD_LRS"}, + "name": "myVMosdisk", + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithUefiSettings.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithUserData.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithUserData.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithUserData.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithUserData.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithUserData.py new file mode 100644 index 00000000000..4b1128ed2dc --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithUserData.py @@ -0,0 +1,74 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_user_data.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="{vm-name}", + parameters={ + "location": "westus", + "properties": { + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": True, + "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", + } + }, + "hardwareProfile": {"vmSize": "Standard_D1_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "{vm-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "vmOSdisk", + }, + }, + "userData": "RXhhbXBsZSBVc2VyRGF0YQ==", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithUserData.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithVMSizeProperties.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithVMSizeProperties.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithVMSizeProperties.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithVMSizeProperties.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithVMSizeProperties.py new file mode 100644 index 00000000000..1e6edbf7c61 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Create_WithVMSizeProperties.py @@ -0,0 +1,77 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_create_with_vm_size_properties.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "location": "westus", + "properties": { + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": True, + "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", + } + }, + "hardwareProfile": { + "vmSize": "Standard_D4_v3", + "vmSizeProperties": {"vCPUsAvailable": 1, "vCPUsPerCore": 1}, + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + "userData": "U29tZSBDdXN0b20gRGF0YQ==", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Create_WithVMSizeProperties.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Deallocate_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Deallocate_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Deallocate_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Deallocate_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Deallocate_MaximumSet_Gen.py new file mode 100644 index 00000000000..f46fafa67a5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Deallocate_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_deallocate_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_deallocate( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Deallocate_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Deallocate_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Deallocate_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Deallocate_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Deallocate_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Deallocate_MinimumSet_Gen.py new file mode 100644 index 00000000000..c0e06609a4e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Deallocate_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_deallocate_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_deallocate( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Deallocate_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Delete_Force.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Delete_Force.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Delete_Force.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Delete_Force.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Delete_Force.py new file mode 100644 index 00000000000..bcf2194f7fd --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Delete_Force.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_delete_force.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_delete( + resource_group_name="myResourceGroup", + vm_name="myVM", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Delete_Force.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Generalize.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Generalize.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Generalize.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Generalize.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Generalize.py new file mode 100644 index 00000000000..033b64ca06f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Generalize.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_generalize.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.generalize( + resource_group_name="myResourceGroup", + vm_name="myVMName", + ) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Generalize.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get.py new file mode 100644 index 00000000000..c1695656391 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.get( + resource_group_name="myResourceGroup", + vm_name="myVM", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_AutoPlacedOnDedicatedHostGroup.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_AutoPlacedOnDedicatedHostGroup.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_AutoPlacedOnDedicatedHostGroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_AutoPlacedOnDedicatedHostGroup.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_AutoPlacedOnDedicatedHostGroup.py new file mode 100644 index 00000000000..671ddefaa1e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_AutoPlacedOnDedicatedHostGroup.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_get_auto_placed_on_dedicated_host_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.get( + resource_group_name="myResourceGroup", + vm_name="myVM", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Get_AutoPlacedOnDedicatedHostGroup.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_InstanceView.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_InstanceView.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_InstanceView.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_InstanceView.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_InstanceView.py new file mode 100644 index 00000000000..412f0252df5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_InstanceView.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_get_instance_view.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.instance_view( + resource_group_name="myResourceGroup", + vm_name="myVM", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Get_InstanceView.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.py new file mode 100644 index 00000000000..abb5bea38cb --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_get_instance_view_auto_placed_on_dedicated_host_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.instance_view( + resource_group_name="myResourceGroup", + vm_name="myVM", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_WithDiskControllerType.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_WithDiskControllerType.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_WithDiskControllerType.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_WithDiskControllerType.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_WithDiskControllerType.py new file mode 100644 index 00000000000..ff4fcf31af7 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_WithDiskControllerType.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_get_with_disk_controller_type.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.get( + resource_group_name="myResourceGroup", + vm_name="myVM", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Get_WithDiskControllerType.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_WithVMSizeProperties.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_WithVMSizeProperties.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_WithVMSizeProperties.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_WithVMSizeProperties.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_WithVMSizeProperties.py new file mode 100644 index 00000000000..75d1d2d33f5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Get_WithVMSizeProperties.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_get_with_vm_size_properties.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.get( + resource_group_name="myResourceGroup", + vm_name="myVM", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Get_WithVMSizeProperties.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_InstallPatches.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_InstallPatches.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_InstallPatches.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_InstallPatches.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_InstallPatches.py new file mode 100644 index 00000000000..9b86c0a7d6e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_InstallPatches.py @@ -0,0 +1,44 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_install_patches.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_install_patches( + resource_group_name="myResourceGroupName", + vm_name="myVMName", + install_patches_input={ + "maximumDuration": "PT4H", + "rebootSetting": "IfRequired", + "windowsParameters": { + "classificationsToInclude": ["Critical", "Security"], + "maxPatchPublishDate": "2020-11-19T02:36:43.0539904+00:00", + "patchNameMasksToExclude": ["*Windows*"], + "patchNameMasksToInclude": ["*SQL*"], + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_InstallPatches.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAll_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAll_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAll_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAll_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAll_MaximumSet_Gen.py new file mode 100644 index 00000000000..dda41852c97 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAll_MaximumSet_Gen.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_list_all_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.list_all() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_ListAll_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAll_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAll_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAll_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAll_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAll_MinimumSet_Gen.py new file mode 100644 index 00000000000..d800b452b52 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAll_MinimumSet_Gen.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_list_all_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.list_all() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_ListAll_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAvailableVmSizes.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAvailableVmSizes.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAvailableVmSizes.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAvailableVmSizes.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAvailableVmSizes.py new file mode 100644 index 00000000000..3dac9ee3218 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListAvailableVmSizes.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_list_available_vm_sizes.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.list_available_sizes( + resource_group_name="myResourceGroup", + vm_name="myVmName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_ListAvailableVmSizes.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListBySubscription_ByLocation.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListBySubscription_ByLocation.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListBySubscription_ByLocation.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListBySubscription_ByLocation.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListBySubscription_ByLocation.py new file mode 100644 index 00000000000..d5516ccc535 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_ListBySubscription_ByLocation.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_list_by_subscription_by_location.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.virtual_machines.list_by_location( + location="eastus", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_ListBySubscription_ByLocation.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_List_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_List_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_List_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_List_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_List_MaximumSet_Gen.py new file mode 100644 index 00000000000..081f27d41e9 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_List_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_list_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.list( + resource_group_name="rgcompute", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_List_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_List_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_List_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_List_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_List_MinimumSet_Gen.py new file mode 100644 index 00000000000..382393e724c --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_List_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_list_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.list( + resource_group_name="rgcompute", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_List_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_MigrateToVirtualMachineScaleSet.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_MigrateToVirtualMachineScaleSet.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_MigrateToVirtualMachineScaleSet.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_MigrateToVirtualMachineScaleSet.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_MigrateToVirtualMachineScaleSet.py new file mode 100644 index 00000000000..cf195bdcd1c --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_MigrateToVirtualMachineScaleSet.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_migrate_to_virtual_machine_scale_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_migrate_to_vm_scale_set( + resource_group_name="myResourceGroup", + vm_name="myVMName", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_MigrateToVirtualMachineScaleSet.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PerformMaintenance_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PerformMaintenance_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PerformMaintenance_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PerformMaintenance_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PerformMaintenance_MaximumSet_Gen.py new file mode 100644 index 00000000000..168dcebd3d5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PerformMaintenance_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_perform_maintenance_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_perform_maintenance( + resource_group_name="rgcompute", + vm_name="aaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_PerformMaintenance_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PerformMaintenance_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PerformMaintenance_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PerformMaintenance_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PerformMaintenance_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PerformMaintenance_MinimumSet_Gen.py new file mode 100644 index 00000000000..f4bc3037400 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PerformMaintenance_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_perform_maintenance_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_perform_maintenance( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_PerformMaintenance_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PowerOff_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PowerOff_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PowerOff_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PowerOff_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PowerOff_MaximumSet_Gen.py new file mode 100644 index 00000000000..52eeaaa90eb --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PowerOff_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_power_off_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_power_off( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_PowerOff_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PowerOff_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PowerOff_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PowerOff_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PowerOff_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PowerOff_MinimumSet_Gen.py new file mode 100644 index 00000000000..4a6528d8127 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_PowerOff_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_power_off_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_power_off( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_PowerOff_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reapply.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reapply.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reapply.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reapply.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reapply.py new file mode 100644 index 00000000000..46f0812e3e6 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reapply.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_reapply.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_reapply( + resource_group_name="ResourceGroup", + vm_name="VMName", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Reapply.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Redeploy_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Redeploy_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Redeploy_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Redeploy_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Redeploy_MaximumSet_Gen.py new file mode 100644 index 00000000000..0383e541315 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Redeploy_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_redeploy_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_redeploy( + resource_group_name="rgcompute", + vm_name="a", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Redeploy_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Redeploy_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Redeploy_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Redeploy_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Redeploy_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Redeploy_MinimumSet_Gen.py new file mode 100644 index 00000000000..d0f2d0ab506 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Redeploy_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_redeploy_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_redeploy( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Redeploy_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reimage.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reimage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reimage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reimage.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reimage.py new file mode 100644 index 00000000000..d55832e7005 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reimage.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_reimage.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_reimage( + resource_group_name="myResourceGroup", + vm_name="myVMName", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Reimage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reimage_NonEphemeralVMs.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reimage_NonEphemeralVMs.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reimage_NonEphemeralVMs.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reimage_NonEphemeralVMs.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reimage_NonEphemeralVMs.py new file mode 100644 index 00000000000..baaeca6b097 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Reimage_NonEphemeralVMs.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_reimage_non_ephemeral_vms.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_reimage( + resource_group_name="myResourceGroup", + vm_name="myVMName", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Reimage_NonEphemeralVMs.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Restart_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Restart_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Restart_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Restart_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Restart_MaximumSet_Gen.py new file mode 100644 index 00000000000..60478c4fd0d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Restart_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_restart_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_restart( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Restart_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Restart_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Restart_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Restart_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Restart_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Restart_MinimumSet_Gen.py new file mode 100644 index 00000000000..5d9c800fa88 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Restart_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_restart_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_restart( + resource_group_name="rgcompute", + vm_name="aaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Restart_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_RetrieveBootDiagnosticsData.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_RetrieveBootDiagnosticsData.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_RetrieveBootDiagnosticsData.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_RetrieveBootDiagnosticsData.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_RetrieveBootDiagnosticsData.py new file mode 100644 index 00000000000..44f4612935a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_RetrieveBootDiagnosticsData.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_retrieve_boot_diagnostics_data.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.retrieve_boot_diagnostics_data( + resource_group_name="ResourceGroup", + vm_name="VMName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_RetrieveBootDiagnosticsData.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_SimulateEviction.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_SimulateEviction.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_SimulateEviction.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_SimulateEviction.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_SimulateEviction.py new file mode 100644 index 00000000000..b292d3f57d9 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_SimulateEviction.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_simulate_eviction.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.simulate_eviction( + resource_group_name="ResourceGroup", + vm_name="VMName", + ) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_SimulateEviction.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Start_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Start_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Start_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Start_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Start_MaximumSet_Gen.py new file mode 100644 index 00000000000..8251148e3f1 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Start_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_start_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_start( + resource_group_name="rgcompute", + vm_name="aaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Start_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Start_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Start_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Start_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Start_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Start_MinimumSet_Gen.py new file mode 100644 index 00000000000..7392ff196b7 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Start_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_start_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machines.begin_start( + resource_group_name="rgcompute", + vm_name="aaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Start_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Update_DetachDataDiskUsingToBeDetachedProperty.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Update_DetachDataDiskUsingToBeDetachedProperty.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Update_DetachDataDiskUsingToBeDetachedProperty.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Update_DetachDataDiskUsingToBeDetachedProperty.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Update_DetachDataDiskUsingToBeDetachedProperty.py new file mode 100644 index 00000000000..04f319008a7 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Update_DetachDataDiskUsingToBeDetachedProperty.py @@ -0,0 +1,70 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_update_detach_data_disk_using_to_be_detached_property.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "properties": { + "hardwareProfile": {"vmSize": "Standard_D2_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "dataDisks": [ + {"createOption": "Empty", "diskSizeGB": 1023, "lun": 0, "toBeDetached": True}, + {"createOption": "Empty", "diskSizeGB": 1023, "lun": 1, "toBeDetached": False}, + ], + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Update_DetachDataDiskUsingToBeDetachedProperty.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Update_ForceDetachDataDisk.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Update_ForceDetachDataDisk.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Update_ForceDetachDataDisk.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Update_ForceDetachDataDisk.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Update_ForceDetachDataDisk.py new file mode 100644 index 00000000000..68d20037a6c --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExamples/VirtualMachine_Update_ForceDetachDataDisk.py @@ -0,0 +1,76 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_update_force_detach_data_disk.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machines.begin_update( + resource_group_name="myResourceGroup", + vm_name="myVM", + parameters={ + "properties": { + "hardwareProfile": {"vmSize": "Standard_D2_v2"}, + "networkProfile": { + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}", + "properties": {"primary": True}, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerName": "myVM", + }, + "storageProfile": { + "dataDisks": [ + { + "createOption": "Empty", + "detachOption": "ForceDetach", + "diskSizeGB": 1023, + "lun": 0, + "toBeDetached": True, + }, + {"createOption": "Empty", "diskSizeGB": 1023, "lun": 1, "toBeDetached": False}, + ], + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + "name": "myVMosdisk", + }, + }, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExamples/VirtualMachine_Update_ForceDetachDataDisk.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MaximumSet_Gen.py new file mode 100644 index 00000000000..4224a15bfdd --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MaximumSet_Gen.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_extension_image_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_extension_images.get( + location="aaaaaaaaaaaaa", + publisher_name="aaaaaaaaaaaaaaaaaaaa", + type="aaaaaaaaaaaaaaaaaa", + version="aaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MinimumSet_Gen.py new file mode 100644 index 00000000000..39809d04def --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MinimumSet_Gen.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_extension_image_get_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_extension_images.get( + location="aaaaaaaaaaaaaa", + publisher_name="aaaaaaaaaaaaaaaaaaaaaaaaaa", + type="aa", + version="aaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_Get_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MaximumSet_Gen.py new file mode 100644 index 00000000000..2c6fe2cdd44 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_extension_image_list_types_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_extension_images.list_types( + location="aaaaaaaaaaaaaaaaaaaaaaaaaa", + publisher_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MinimumSet_Gen.py new file mode 100644 index 00000000000..ac74ec41863 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_extension_image_list_types_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_extension_images.list_types( + location="aaaa", + publisher_name="aa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListTypes_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MaximumSet_Gen.py new file mode 100644 index 00000000000..201ee140c9f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MaximumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_extension_image_list_versions_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_extension_images.list_versions( + location="aaaaaaaaaaaaaaaaaaaaaaaaaa", + publisher_name="aaaaaaaaaaaaaaaaaaaa", + type="aaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MinimumSet_Gen.py new file mode 100644 index 00000000000..51285bf9fcd --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MinimumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_extension_image_list_versions_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_extension_images.list_versions( + location="aaaaaaaaa", + publisher_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + type="aaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineExtensionImageExamples/VirtualMachineExtensionImage_ListVersions_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_Get_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_Get_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_Get_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_Get_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_Get_MaximumSet_Gen.py new file mode 100644 index 00000000000..19027577ab5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_Get_MaximumSet_Gen.py @@ -0,0 +1,37 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_image_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images.get( + location="aaaaaa", + publisher_name="aaa", + offer="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + skus="aaaaaaaaaaaaaaaaaaaaaaaaaaa", + version="aaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_Get_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_Get_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_Get_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_Get_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_Get_MinimumSet_Gen.py new file mode 100644 index 00000000000..5b36d13ecad --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_Get_MinimumSet_Gen.py @@ -0,0 +1,37 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_image_get_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images.get( + location="aaaaaaaaaaaa", + publisher_name="aaaaaaaaaaa", + offer="aa", + skus="aaaaaaaaa", + version="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_Get_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MaximumSet_Gen.py new file mode 100644 index 00000000000..aebd95b2f04 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_image_list_offers_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images.list_offers( + location="aaaaaaa", + publisher_name="aaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MinimumSet_Gen.py new file mode 100644 index 00000000000..43b995f5fc1 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_image_list_offers_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images.list_offers( + location="aaaaaaaaaaaaaaaaa", + publisher_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListOffers_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MaximumSet_Gen.py new file mode 100644 index 00000000000..674d03ad4bb --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_image_list_publishers_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images.list_publishers( + location="aaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MinimumSet_Gen.py new file mode 100644 index 00000000000..9e9457c4035 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_image_list_publishers_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images.list_publishers( + location="aaaaaaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListPublishers_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MaximumSet_Gen.py new file mode 100644 index 00000000000..c15cdd9be25 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MaximumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_image_list_skus_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images.list_skus( + location="aaaa", + publisher_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaa", + offer="aaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MinimumSet_Gen.py new file mode 100644 index 00000000000..d7e4c69ce56 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MinimumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_image_list_skus_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images.list_skus( + location="aaaa", + publisher_name="aaaaaaaaaaaaa", + offer="aaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_ListSkus_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_List_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_List_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_List_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_List_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_List_MaximumSet_Gen.py new file mode 100644 index 00000000000..ce3922673a6 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_List_MaximumSet_Gen.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_image_list_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images.list( + location="aaaaaaaaaaaaaaa", + publisher_name="aaaaaa", + offer="aaaaaaaaaaaaaaaa", + skus="aaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_List_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_List_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_List_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_List_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_List_MinimumSet_Gen.py new file mode 100644 index 00000000000..7a577e0b74e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImage_List_MinimumSet_Gen.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_image_list_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images.list( + location="aaaaaaa", + publisher_name="aaaaaaaaaaa", + offer="aaaaaaaaaa", + skus="aaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImage_List_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MaximumSet_Gen.py new file mode 100644 index 00000000000..e029c04ba30 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MaximumSet_Gen.py @@ -0,0 +1,38 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_images_edge_zone_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images_edge_zone.get( + location="aaaaaaaaaaaaaaaaaaaaaaaa", + edge_zone="aaaaaaaa", + publisher_name="aaaaaaaaaaaaaaaaaaaaaaa", + offer="aaaaaaaaaaaaaaaaaaaaaaaaaaa", + skus="aaaaaaaaaa", + version="aaaaaaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MinimumSet_Gen.py new file mode 100644 index 00000000000..6308ad96b3e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MinimumSet_Gen.py @@ -0,0 +1,38 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_images_edge_zone_get_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images_edge_zone.get( + location="aaaaaaaaaaaaaaaaaaaaaaa", + edge_zone="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + publisher_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + offer="aaaaaaaaaaa", + skus="aaaaaaaaaaaaaaaaaa", + version="aa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_Get_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MaximumSet_Gen.py new file mode 100644 index 00000000000..b548d14209e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_images_edge_zone_list_by_edge_zone_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5ece5940-d962-4dad-a98f-ca9ac0f021a5", + ) + + response = client.virtual_machine_images.list_by_edge_zone( + location="WestUS", + edge_zone="microsoftlosangeles1", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MinimumSet_Gen.py new file mode 100644 index 00000000000..0a43c0e9535 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_images_edge_zone_list_by_edge_zone_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="5ece5940-d962-4dad-a98f-ca9ac0f021a5", + ) + + response = client.virtual_machine_images.list_by_edge_zone( + location="WestUS", + edge_zone="microsoftlosangeles1", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListByEdgeZone_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MaximumSet_Gen.py new file mode 100644 index 00000000000..c2c437f8047 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MaximumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_images_edge_zone_list_offers_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images_edge_zone.list_offers( + location="aaaaaaaaaaaaaaaaaa", + edge_zone="aaaaaaaaaaaaaaaaaaa", + publisher_name="aaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MinimumSet_Gen.py new file mode 100644 index 00000000000..c32d7d674db --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MinimumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_images_edge_zone_list_offers_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images_edge_zone.list_offers( + location="aaaaaaaaaaaaaa", + edge_zone="aaaaaaaaaaaaaaaaaaaaa", + publisher_name="aaaaaaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListOffers_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MaximumSet_Gen.py new file mode 100644 index 00000000000..cbf61e1bcd5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_images_edge_zone_list_publishers_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images_edge_zone.list_publishers( + location="aaaaaa", + edge_zone="aaaaaaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MinimumSet_Gen.py new file mode 100644 index 00000000000..3aa126c777d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_images_edge_zone_list_publishers_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images_edge_zone.list_publishers( + location="aaaa", + edge_zone="aaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListPublishers_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MaximumSet_Gen.py new file mode 100644 index 00000000000..272bc946999 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MaximumSet_Gen.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_images_edge_zone_list_skus_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images_edge_zone.list_skus( + location="aaaaaaaaaaaa", + edge_zone="aaaaa", + publisher_name="aaaaaaaaaaaa", + offer="aaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MinimumSet_Gen.py new file mode 100644 index 00000000000..31132a3df4a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MinimumSet_Gen.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_images_edge_zone_list_skus_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images_edge_zone.list_skus( + location="aaaaaaaaaaaaaaaaaaaa", + edge_zone="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + publisher_name="aaaaaaaaa", + offer="aaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_ListSkus_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MaximumSet_Gen.py new file mode 100644 index 00000000000..bb80052d6d0 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MaximumSet_Gen.py @@ -0,0 +1,37 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_images_edge_zone_list_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images_edge_zone.list( + location="aaaaaaaaaaaaaaa", + edge_zone="aaaaaaaaaaaaaaaaaaaaaaaaa", + publisher_name="aaaa", + offer="aaaaaaaaaaaaaaaaaaaaaaaaaa", + skus="aaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MinimumSet_Gen.py new file mode 100644 index 00000000000..22524c6881b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MinimumSet_Gen.py @@ -0,0 +1,37 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_images_edge_zone_list_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images_edge_zone.list( + location="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + edge_zone="aaaaa", + publisher_name="aaaaaaaaaaaaaaaaaaa", + offer="aaaaaaaaaaaaaaaaaaaaaaaaaaa", + skus="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImagesEdgeZone_List_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImages_ListWithProperties_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImages_ListWithProperties_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImages_ListWithProperties_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImages_ListWithProperties_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImages_ListWithProperties_MaximumSet_Gen.py new file mode 100644 index 00000000000..0a37b908c5d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImages_ListWithProperties_MaximumSet_Gen.py @@ -0,0 +1,37 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_images_list_with_properties_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images.list_with_properties( + location="eastus", + publisher_name="MicrosoftWindowsServer", + offer="WindowsServer", + skus="2022-datacenter-azure-edition", + expand="Properties", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListWithProperties_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImages_ListWithProperties_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImages_ListWithProperties_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImages_ListWithProperties_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImages_ListWithProperties_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImages_ListWithProperties_MinimumSet_Gen.py new file mode 100644 index 00000000000..9e045e4160e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineImageExamples/VirtualMachineImages_ListWithProperties_MinimumSet_Gen.py @@ -0,0 +1,37 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_images_list_with_properties_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_images.list_with_properties( + location="eastus", + publisher_name="MicrosoftWindowsServer", + offer="WindowsServer", + skus="2022-datacenter-azure-edition", + expand="Properties", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineImageExamples/VirtualMachineImages_ListWithProperties_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_CreateOrUpdate_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_CreateOrUpdate_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_CreateOrUpdate_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_CreateOrUpdate_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_CreateOrUpdate_MaximumSet_Gen.py new file mode 100644 index 00000000000..92ff3022629 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_CreateOrUpdate_MaximumSet_Gen.py @@ -0,0 +1,50 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_extension_create_or_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_extensions.begin_create_or_update( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaa", + vmss_extension_name="aaaaaaaaaaaaaaaaaaaaa", + extension_parameters={ + "name": "{extension-name}", + "properties": { + "autoUpgradeMinorVersion": True, + "enableAutomaticUpgrade": True, + "forceUpdateTag": "aaaaaaaaa", + "protectedSettings": {}, + "provisionAfterExtensions": ["aa"], + "publisher": "{extension-Publisher}", + "settings": {}, + "suppressFailures": True, + "type": "{extension-Type}", + "typeHandlerVersion": "{handler-version}", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_CreateOrUpdate_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MaximumSet_Gen.py new file mode 100644 index 00000000000..be82c28026e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_extension_delete_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_extensions.begin_delete( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + vmss_extension_name="aaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MinimumSet_Gen.py new file mode 100644 index 00000000000..7e0e5dac673 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_extension_delete_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_extensions.begin_delete( + resource_group_name="rgcompute", + vm_scale_set_name="aaaa", + vmss_extension_name="aaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Delete_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MaximumSet_Gen.py new file mode 100644 index 00000000000..7afdbcce84a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MaximumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_extension_get_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_extensions.get( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaa", + vmss_extension_name="aaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MinimumSet_Gen.py new file mode 100644 index 00000000000..b991c53973d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MinimumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_extension_get_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_extensions.get( + resource_group_name="rgcompute", + vm_scale_set_name="a", + vmss_extension_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Get_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MaximumSet_Gen.py new file mode 100644 index 00000000000..8a353d932b3 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MaximumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_extension_list_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_extensions.list( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaa", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MinimumSet_Gen.py new file mode 100644 index 00000000000..167a2b92524 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MinimumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_extension_list_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_extensions.list( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_List_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_RollingUpgrade.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_RollingUpgrade.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_RollingUpgrade.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_RollingUpgrade.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_RollingUpgrade.py new file mode 100644 index 00000000000..aa248f20f12 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_RollingUpgrade.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_extension_rolling_upgrade.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_rolling_upgrades.begin_start_extension_upgrade( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_RollingUpgrade.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Update_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Update_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Update_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Update_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Update_MaximumSet_Gen.py new file mode 100644 index 00000000000..a3acafac031 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Update_MaximumSet_Gen.py @@ -0,0 +1,49 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_extension_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_extensions.begin_update( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + vmss_extension_name="aaaa", + extension_parameters={ + "properties": { + "autoUpgradeMinorVersion": True, + "enableAutomaticUpgrade": True, + "forceUpdateTag": "aaaaaaaaa", + "protectedSettings": {}, + "provisionAfterExtensions": ["aa"], + "publisher": "{extension-Publisher}", + "settings": {}, + "suppressFailures": True, + "type": "{extension-Type}", + "typeHandlerVersion": "{handler-version}", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetExtension_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MaximumSet_Gen.py new file mode 100644 index 00000000000..2a3c85559f6 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_rolling_upgrade_cancel_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_rolling_upgrades.begin_cancel( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MinimumSet_Gen.py new file mode 100644 index 00000000000..1d25f647293 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_rolling_upgrade_cancel_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_rolling_upgrades.begin_cancel( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_Cancel_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MaximumSet_Gen.py new file mode 100644 index 00000000000..f6f19df158f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_rolling_upgrade_get_latest_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_rolling_upgrades.get_latest( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MinimumSet_Gen.py new file mode 100644 index 00000000000..57fa0dc5f87 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_rolling_upgrade_get_latest_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_rolling_upgrades.get_latest( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_GetLatest_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MaximumSet_Gen.py new file mode 100644 index 00000000000..993fc7f2618 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_rolling_upgrades.begin_start_os_upgrade( + resource_group_name="rgcompute", + vm_scale_set_name="aaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MinimumSet_Gen.py new file mode 100644 index 00000000000..5bf2569845a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_rolling_upgrade_start_os_upgrade_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_rolling_upgrades.begin_start_os_upgrade( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetRollingUpgrade_StartOSUpgrade_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Create.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Create.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Create.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Create.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Create.py new file mode 100644 index 00000000000..9f16a3557ca --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Create.py @@ -0,0 +1,45 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_extension_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vm_extensions.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="myvmScaleSet", + instance_id="0", + vm_extension_name="myVMExtension", + extension_parameters={ + "properties": { + "autoUpgradeMinorVersion": True, + "publisher": "extPublisher", + "settings": {"UserName": "xyz@microsoft.com"}, + "type": "extType", + "typeHandlerVersion": "1.2", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Create.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Delete.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Delete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Delete.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Delete.py new file mode 100644 index 00000000000..f444dd2eb88 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Delete.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_extension_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vm_extensions.begin_delete( + resource_group_name="myResourceGroup", + vm_scale_set_name="myvmScaleSet", + instance_id="0", + vm_extension_name="myVMExtension", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Delete.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Get.py new file mode 100644 index 00000000000..6babf861976 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Get.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_extension_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vm_extensions.get( + resource_group_name="myResourceGroup", + vm_scale_set_name="myvmScaleSet", + instance_id="0", + vm_extension_name="myVMExtension", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_List.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_List.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_List.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_List.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_List.py new file mode 100644 index 00000000000..476ec9e87db --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_List.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_extension_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vm_extensions.list( + resource_group_name="myResourceGroup", + vm_scale_set_name="myvmScaleSet", + instance_id="0", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_List.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Update.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Update.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Update.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Update.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Update.py new file mode 100644 index 00000000000..e407b09a074 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Update.py @@ -0,0 +1,45 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_extension_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vm_extensions.begin_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="myvmScaleSet", + instance_id="0", + vm_extension_name="myVMExtension", + extension_parameters={ + "properties": { + "autoUpgradeMinorVersion": True, + "publisher": "extPublisher", + "settings": {"UserName": "xyz@microsoft.com"}, + "type": "extType", + "typeHandlerVersion": "1.2", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVMExtension_Update.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ApproveRollingUpgrade.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ApproveRollingUpgrade.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ApproveRollingUpgrade.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ApproveRollingUpgrade.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ApproveRollingUpgrade.py new file mode 100644 index 00000000000..c0bf2331e14 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ApproveRollingUpgrade.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_approve_rolling_upgrade.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_approve_rolling_upgrade( + resource_group_name="rgcompute", + vm_scale_set_name="vmssToApproveRollingUpgradeOn", + instance_id="0123", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ApproveRollingUpgrade.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MaximumSet_Gen.py new file mode 100644 index 00000000000..2a5e1eff3e0 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MaximumSet_Gen.py @@ -0,0 +1,67 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_attach_detach_data_disks_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vms.begin_attach_detach_data_disks( + resource_group_name="rgcompute", + vm_scale_set_name="azure-vmscaleset", + instance_id="0", + parameters={ + "dataDisksToAttach": [ + { + "caching": "ReadOnly", + "diskEncryptionSet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d", + "lun": 1, + "writeAcceleratorEnabled": True, + }, + { + "caching": "ReadWrite", + "diskEncryptionSet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_2_disk3_7d5e664bdafa49baa780eb2d128ff38e", + "lun": 2, + "writeAcceleratorEnabled": False, + }, + ], + "dataDisksToDetach": [ + { + "detachOption": "ForceDetach", + "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x", + }, + { + "detachOption": "ForceDetach", + "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_4_disk4_4d4e784bdafa49baa780eb2d256ff41z", + }, + ], + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MinimumSet_Gen.py new file mode 100644 index 00000000000..fc38ff89d46 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MinimumSet_Gen.py @@ -0,0 +1,47 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_attach_detach_data_disks_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vms.begin_attach_detach_data_disks( + resource_group_name="rgcompute", + vm_scale_set_name="azure-vmscaleset", + instance_id="0", + parameters={ + "dataDisksToAttach": [ + { + "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d" + } + ], + "dataDisksToDetach": [ + { + "diskId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_1_disk1_1a4e784bdafa49baa780eb2d128ff65x" + } + ], + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_AttachDetachDataDisks_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MaximumSet_Gen.py new file mode 100644 index 00000000000..9319eda9f24 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_deallocate_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_deallocate( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaa", + instance_id="aaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MinimumSet_Gen.py new file mode 100644 index 00000000000..80ef5095714 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_deallocate_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_deallocate( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaa", + instance_id="aaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Deallocate_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Delete_Force.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Delete_Force.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Delete_Force.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Delete_Force.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Delete_Force.py new file mode 100644 index 00000000000..97f1d9b38fa --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Delete_Force.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_delete_force.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_delete( + resource_group_name="myResourceGroup", + vm_scale_set_name="myvmScaleSet", + instance_id="0", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Delete_Force.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.py new file mode 100644 index 00000000000..05d181cb7e3 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_get_instance_view_auto_placed_on_dedicated_host_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vms.get_instance_view( + resource_group_name="myResourceGroup", + vm_scale_set_name="myVirtualMachineScaleSet", + instance_id="0", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_InstanceViewAutoPlacedOnDedicatedHostGroup.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithResilientVMDeletionStatus.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithResilientVMDeletionStatus.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithResilientVMDeletionStatus.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithResilientVMDeletionStatus.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithResilientVMDeletionStatus.py new file mode 100644 index 00000000000..caee73a8912 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithResilientVMDeletionStatus.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_get_with_resilient_vm_deletion_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vms.get( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + instance_id="1", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithResilientVMDeletionStatus.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithUserData.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithUserData.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithUserData.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithUserData.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithUserData.py new file mode 100644 index 00000000000..6f271cf3137 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithUserData.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_get_with_user_data.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vms.get( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + instance_id="0", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithUserData.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithVMSizeProperties.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithVMSizeProperties.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithVMSizeProperties.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithVMSizeProperties.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithVMSizeProperties.py new file mode 100644 index 00000000000..9ebbd2947e6 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithVMSizeProperties.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_get_with_vm_size_properties.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vms.get( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + instance_id="0", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Get_WithVMSizeProperties.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MaximumSet_Gen.py new file mode 100644 index 00000000000..db14343a39c --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MaximumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_list_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vms.list( + resource_group_name="rgcompute", + virtual_machine_scale_set_name="aaaaaaaaaaaaaaaaaaaaaa", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MinimumSet_Gen.py new file mode 100644 index 00000000000..09ad806cec5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MinimumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_list_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vms.list( + resource_group_name="rgcompute", + virtual_machine_scale_set_name="aaaaaaaaaaaaaa", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_WithResiliencyView.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_WithResiliencyView.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_WithResiliencyView.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_WithResiliencyView.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_WithResiliencyView.py new file mode 100644 index 00000000000..28487a378df --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_WithResiliencyView.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_list_with_resiliency_view.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vms.list( + resource_group_name="resourceGroupname", + virtual_machine_scale_set_name="vmssName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_List_WithResiliencyView.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MaximumSet_Gen.py new file mode 100644 index 00000000000..3a4e03a0ad1 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_perform_maintenance_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_perform_maintenance( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaa", + instance_id="aaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MinimumSet_Gen.py new file mode 100644 index 00000000000..be89a9fe2f1 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_perform_maintenance_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_perform_maintenance( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaa", + instance_id="aaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PerformMaintenance_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MaximumSet_Gen.py new file mode 100644 index 00000000000..cafa0511732 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_power_off_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_power_off( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaa", + instance_id="aaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MinimumSet_Gen.py new file mode 100644 index 00000000000..eaf36d51896 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_power_off_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_power_off( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + instance_id="aaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_PowerOff_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MaximumSet_Gen.py new file mode 100644 index 00000000000..b4925cab101 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_redeploy_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_redeploy( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaa", + instance_id="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MinimumSet_Gen.py new file mode 100644 index 00000000000..634d276f336 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_redeploy_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_redeploy( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaa", + instance_id="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Redeploy_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MaximumSet_Gen.py new file mode 100644 index 00000000000..ed9df72a016 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_reimage_all_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_reimage_all( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaa", + instance_id="aaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MinimumSet_Gen.py new file mode 100644 index 00000000000..5cdc1de1e08 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_reimage_all_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_reimage_all( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaa", + instance_id="aaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_ReimageAll_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MaximumSet_Gen.py new file mode 100644 index 00000000000..fc15ecee61b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_reimage_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_reimage( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaa", + instance_id="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MinimumSet_Gen.py new file mode 100644 index 00000000000..22a92c886f7 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_reimage_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_reimage( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaa", + instance_id="aaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Reimage_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MaximumSet_Gen.py new file mode 100644 index 00000000000..3ce0feed1e5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_restart_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_restart( + resource_group_name="rgcompute", + vm_scale_set_name="aa", + instance_id="aaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MinimumSet_Gen.py new file mode 100644 index 00000000000..713ea17af22 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_restart_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_restart( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaa", + instance_id="aaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Restart_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_RetrieveBootDiagnosticsData.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_RetrieveBootDiagnosticsData.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_RetrieveBootDiagnosticsData.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_RetrieveBootDiagnosticsData.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_RetrieveBootDiagnosticsData.py new file mode 100644 index 00000000000..018f936f4e5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_RetrieveBootDiagnosticsData.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_retrieve_boot_diagnostics_data.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vms.retrieve_boot_diagnostics_data( + resource_group_name="ResourceGroup", + vm_scale_set_name="myvmScaleSet", + instance_id="0", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_RetrieveBootDiagnosticsData.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_SimulateEviction.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_SimulateEviction.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_SimulateEviction.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_SimulateEviction.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_SimulateEviction.py new file mode 100644 index 00000000000..22e1d3481b3 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_SimulateEviction.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_simulate_eviction.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.simulate_eviction( + resource_group_name="ResourceGroup", + vm_scale_set_name="VmScaleSetName", + instance_id="InstanceId", + ) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_SimulateEviction.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MaximumSet_Gen.py new file mode 100644 index 00000000000..1b58c692137 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_start_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_start( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaa", + instance_id="aaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MinimumSet_Gen.py new file mode 100644 index 00000000000..956013f96f4 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_start_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_set_vms.begin_start( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaa", + instance_id="aaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Start_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MaximumSet_Gen.py new file mode 100644 index 00000000000..9f38e00e558 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MaximumSet_Gen.py @@ -0,0 +1,433 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vms.begin_update( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaa", + instance_id="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + parameters={ + "location": "westus", + "plan": { + "name": "aaaaaaaaaa", + "product": "aaaaaaaaaaaaaaaaaaaa", + "promotionCode": "aaaaaaaaaaaaaaaaaaaa", + "publisher": "aaaaaaaaaaaaaaaaaaaaaa", + }, + "properties": { + "additionalCapabilities": {"hibernationEnabled": True, "ultraSSDEnabled": True}, + "availabilitySet": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + }, + "diagnosticsProfile": {"bootDiagnostics": {"enabled": True, "storageUri": "aaaaaaaaaaaaa"}}, + "hardwareProfile": { + "vmSize": "Basic_A0", + "vmSizeProperties": {"vCPUsAvailable": 9, "vCPUsPerCore": 12}, + }, + "instanceView": { + "bootDiagnostics": { + "status": { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z", + } + }, + "disks": [ + { + "encryptionSettings": [ + { + "diskEncryptionKey": { + "secretUrl": "aaaaaaaa", + "sourceVault": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + }, + }, + "enabled": True, + "keyEncryptionKey": { + "keyUrl": "aaaaaaaaaaaaaa", + "sourceVault": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + }, + }, + } + ], + "name": "aaaaaaaaaaa", + "statuses": [ + { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z", + } + ], + } + ], + "extensions": [ + { + "name": "aaaaaaaaaaaaaaaaa", + "statuses": [ + { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z", + } + ], + "substatuses": [ + { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z", + } + ], + "type": "aaaaaaaaa", + "typeHandlerVersion": "aaaaaaaaaaaaaaaaaaaaaaaaaa", + } + ], + "maintenanceRedeployStatus": { + "isCustomerInitiatedMaintenanceAllowed": True, + "lastOperationMessage": "aaaaaa", + "lastOperationResultCode": "None", + "maintenanceWindowEndTime": "2021-11-30T12:58:26.531Z", + "maintenanceWindowStartTime": "2021-11-30T12:58:26.531Z", + "preMaintenanceWindowEndTime": "2021-11-30T12:58:26.531Z", + "preMaintenanceWindowStartTime": "2021-11-30T12:58:26.531Z", + }, + "placementGroupId": "aaa", + "platformFaultDomain": 14, + "platformUpdateDomain": 23, + "rdpThumbPrint": "aaaaaaaaaaaaaaaaaaaaaaaaaaa", + "statuses": [ + { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z", + } + ], + "vmAgent": { + "extensionHandlers": [ + { + "status": { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z", + }, + "type": "aaaaaaaaaaaaa", + "typeHandlerVersion": "aaaaa", + } + ], + "statuses": [ + { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z", + } + ], + "vmAgentVersion": "aaaaaaaaaaaaaaaaaaaaaaa", + }, + "vmHealth": { + "status": { + "code": "aaaaaaaaaaaaaaaaaaaaaaa", + "displayStatus": "aaaaaa", + "level": "Info", + "message": "a", + "time": "2021-11-30T12:58:26.522Z", + } + }, + }, + "licenseType": "aaaaaaaaaa", + "networkProfile": { + "networkApiVersion": "2020-11-01", + "networkInterfaceConfigurations": [ + { + "name": "aaaaaaaaaaa", + "properties": { + "deleteOption": "Delete", + "dnsSettings": {"dnsServers": ["aaaaaa"]}, + "dscpConfiguration": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + }, + "enableAcceleratedNetworking": True, + "enableFpga": True, + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "aa", + "properties": { + "applicationGatewayBackendAddressPools": [ + { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + ], + "applicationSecurityGroups": [ + { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + ], + "loadBalancerBackendAddressPools": [ + { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + ], + "primary": True, + "privateIPAddressVersion": "IPv4", + "publicIPAddressConfiguration": { + "name": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "properties": { + "deleteOption": "Delete", + "dnsSettings": {"domainNameLabel": "aaaaaaaaaaaaaaaaaaaaaaaaa"}, + "idleTimeoutInMinutes": 2, + "ipTags": [ + { + "ipTagType": "aaaaaaaaaaaaaaaaaaaaaaaaa", + "tag": "aaaaaaaaaaaaaaaaaaaa", + } + ], + "publicIPAddressVersion": "IPv4", + "publicIPAllocationMethod": "Dynamic", + "publicIPPrefix": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + }, + }, + "sku": {"name": "Basic", "tier": "Regional"}, + }, + "subnet": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + }, + }, + } + ], + "networkSecurityGroup": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + }, + "primary": True, + }, + } + ], + "networkInterfaces": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachineScaleSets/{vmss-name}/virtualMachines/0/networkInterfaces/vmsstestnetconfig5415", + "properties": {"deleteOption": "Delete", "primary": True}, + } + ], + }, + "networkProfileConfiguration": { + "networkInterfaceConfigurations": [ + { + "name": "vmsstestnetconfig5415", + "properties": { + "deleteOption": "Delete", + "dnsSettings": {"dnsServers": []}, + "enableAcceleratedNetworking": True, + "enableFpga": True, + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "vmsstestnetconfig9693", + "properties": { + "applicationGatewayBackendAddressPools": [ + { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + ], + "applicationSecurityGroups": [ + { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + ], + "loadBalancerBackendAddressPools": [ + { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + ], + "loadBalancerInboundNatPools": [ + { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + } + ], + "primary": True, + "privateIPAddressVersion": "IPv4", + "publicIPAddressConfiguration": { + "name": "aaaaaaaaaaaaaaaaaa", + "properties": { + "deleteOption": "Delete", + "dnsSettings": {"domainNameLabel": "aaaaaaaaaaaaaaaaaa"}, + "idleTimeoutInMinutes": 18, + "ipTags": [ + {"ipTagType": "aaaaaaa", "tag": "aaaaaaaaaaaaaaaaaaaaaaaaaaa"} + ], + "publicIPAddressVersion": "IPv4", + "publicIPPrefix": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + }, + }, + "sku": {"name": "Basic", "tier": "Regional"}, + }, + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/vn4071/subnets/sn5503" + }, + }, + } + ], + "networkSecurityGroup": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + }, + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "aaaaaaaaaaaaaaaa", + "adminUsername": "Foo12", + "allowExtensionOperations": True, + "computerName": "test000000", + "customData": "aaaa", + "linuxConfiguration": { + "disablePasswordAuthentication": True, + "patchSettings": {"assessmentMode": "ImageDefault", "patchMode": "ImageDefault"}, + "provisionVMAgent": True, + "ssh": {"publicKeys": [{"keyData": "aaaaaa", "path": "aaa"}]}, + }, + "requireGuestProvisionSignal": True, + "secrets": [], + "windowsConfiguration": { + "additionalUnattendContent": [ + { + "componentName": "Microsoft-Windows-Shell-Setup", + "content": "aaaaaaaaaaaaaaaaaaaa", + "passName": "OobeSystem", + "settingName": "AutoLogon", + } + ], + "enableAutomaticUpdates": True, + "patchSettings": { + "assessmentMode": "ImageDefault", + "enableHotpatching": True, + "patchMode": "Manual", + }, + "provisionVMAgent": True, + "timeZone": "aaaaaaaaaaaaaaaaaaaaaaaaaaa", + "winRM": {"listeners": [{"certificateUrl": "aaaaaaaaaaaaaaaaaaaaaa", "protocol": "Http"}]}, + }, + }, + "protectionPolicy": {"protectFromScaleIn": True, "protectFromScaleSetActions": True}, + "securityProfile": { + "encryptionAtHost": True, + "securityType": "TrustedLaunch", + "uefiSettings": {"secureBootEnabled": True, "vTpmEnabled": True}, + }, + "storageProfile": { + "dataDisks": [ + { + "caching": "None", + "createOption": "Empty", + "deleteOption": "Delete", + "detachOption": "ForceDetach", + "diskSizeGB": 128, + "image": { + "uri": "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd" + }, + "lun": 1, + "managedDisk": { + "diskEncryptionSet": {"id": "aaaaaaaaaaaa"}, + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d", + "storageAccountType": "Standard_LRS", + }, + "name": "vmss3176_vmss3176_0_disk2_6c4f554bdafa49baa780eb2d128ff39d", + "toBeDetached": True, + "vhd": { + "uri": "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd" + }, + "writeAcceleratorEnabled": True, + } + ], + "imageReference": { + "id": "a", + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sharedGalleryImageId": "aaaaaaaaaaaaaaaaaaaa", + "sku": "2012-R2-Datacenter", + "version": "4.127.20180315", + }, + "osDisk": { + "caching": "None", + "createOption": "FromImage", + "deleteOption": "Delete", + "diffDiskSettings": {"option": "Local", "placement": "CacheDisk"}, + "diskSizeGB": 127, + "encryptionSettings": { + "diskEncryptionKey": { + "secretUrl": "aaaaaaaa", + "sourceVault": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + }, + }, + "enabled": True, + "keyEncryptionKey": { + "keyUrl": "aaaaaaaaaaaaaa", + "sourceVault": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + }, + }, + }, + "image": { + "uri": "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd" + }, + "managedDisk": { + "diskEncryptionSet": {"id": "aaaaaaaaaaaa"}, + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc", + "storageAccountType": "Standard_LRS", + }, + "name": "vmss3176_vmss3176_0_OsDisk_1_6d72b805e50e4de6830303c5055077fc", + "osType": "Windows", + "vhd": { + "uri": "https://{storageAccountName}.blob.core.windows.net/{containerName}/{vhdName}.vhd" + }, + "writeAcceleratorEnabled": True, + }, + }, + "userData": "RXhhbXBsZSBVc2VyRGF0YQ==", + }, + "sku": {"capacity": 29, "name": "Classic", "tier": "aaaaaaaaaaaaaa"}, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MinimumSet_Gen.py new file mode 100644 index 00000000000..465f805c214 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MinimumSet_Gen.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_vm_update_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_set_vms.begin_update( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaa", + instance_id="aaaaaaaaaaaaaaaaaaaa", + parameters={"location": "westus"}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSetVM_Update_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ApproveRollingUpgrade.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ApproveRollingUpgrade.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ApproveRollingUpgrade.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ApproveRollingUpgrade.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ApproveRollingUpgrade.py new file mode 100644 index 00000000000..03b57962ee0 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ApproveRollingUpgrade.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_approve_rolling_upgrade.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_approve_rolling_upgrade( + resource_group_name="rgcompute", + vm_scale_set_name="vmssToApproveRollingUpgradeOn", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ApproveRollingUpgrade.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ConvertToSinglePlacementGroup_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ConvertToSinglePlacementGroup_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ConvertToSinglePlacementGroup_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ConvertToSinglePlacementGroup_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ConvertToSinglePlacementGroup_MaximumSet_Gen.py new file mode 100644 index 00000000000..ba75137cf70 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ConvertToSinglePlacementGroup_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_convert_to_single_placement_group_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.convert_to_single_placement_group( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + parameters={"activePlacementGroupId": "aaaaaaaaaaaaaaaaaaaaaaaaaaa"}, + ) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ConvertToSinglePlacementGroup_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacement.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacement.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacement.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacement.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacement.py new file mode 100644 index 00000000000..2e132d770eb --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacement.py @@ -0,0 +1,85 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "windows-data-science-vm", + "publisher": "microsoft-ads", + "sku": "windows2016", + "version": "latest", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "diffDiskSettings": {"option": "Local", "placement": "ResourceDisk"}, + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_DS1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacement.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacementAsNvmeDisk.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacementAsNvmeDisk.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacementAsNvmeDisk.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacementAsNvmeDisk.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacementAsNvmeDisk.py new file mode 100644 index 00000000000..73ffd3f93a8 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacementAsNvmeDisk.py @@ -0,0 +1,85 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_a_with_diff_os_disk_using_diff_disk_placement_as_nvme_disk.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "windows-data-science-vm", + "publisher": "microsoft-ads", + "sku": "windows2016", + "version": "latest", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "diffDiskSettings": {"option": "Local", "placement": "NvmeDisk"}, + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_DS1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_CreateA_WithDiffOsDiskUsingDiffDiskPlacementAsNvmeDisk.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_CustomImageFromAnUnmanagedGeneralizedOsImage.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_CustomImageFromAnUnmanagedGeneralizedOsImage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_CustomImageFromAnUnmanagedGeneralizedOsImage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_CustomImageFromAnUnmanagedGeneralizedOsImage.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_CustomImageFromAnUnmanagedGeneralizedOsImage.py new file mode 100644 index 00000000000..411389274b4 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_CustomImageFromAnUnmanagedGeneralizedOsImage.py @@ -0,0 +1,80 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_custom_image_from_an_unmanaged_generalized_os_image.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "image": { + "uri": "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/{existing-generalized-os-image-blob-name}.vhd" + }, + "name": "osDisk", + } + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_CustomImageFromAnUnmanagedGeneralizedOsImage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromACustomImage.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromACustomImage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromACustomImage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromACustomImage.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromACustomImage.py new file mode 100644 index 00000000000..4516d4a1d46 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromACustomImage.py @@ -0,0 +1,80 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_from_acustom_image.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromACustomImage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromAGeneralizedSharedImage.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromAGeneralizedSharedImage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromAGeneralizedSharedImage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromAGeneralizedSharedImage.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromAGeneralizedSharedImage.py new file mode 100644 index 00000000000..fea3d74584b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromAGeneralizedSharedImage.py @@ -0,0 +1,80 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_from_ageneralized_shared_image.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage" + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromAGeneralizedSharedImage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromASpecializedSharedImage.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromASpecializedSharedImage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromASpecializedSharedImage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromASpecializedSharedImage.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromASpecializedSharedImage.py new file mode 100644 index 00000000000..63fcdd22732 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromASpecializedSharedImage.py @@ -0,0 +1,75 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_from_aspecialized_shared_image.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "storageProfile": { + "imageReference": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/mySharedGallery/images/mySharedImage" + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromASpecializedSharedImage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithDisableTcpStateTrackingNetworkInterface.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithDisableTcpStateTrackingNetworkInterface.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithDisableTcpStateTrackingNetworkInterface.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithDisableTcpStateTrackingNetworkInterface.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithDisableTcpStateTrackingNetworkInterface.py new file mode 100644 index 00000000000..33830c30c80 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithDisableTcpStateTrackingNetworkInterface.py @@ -0,0 +1,103 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_from_with_disable_tcp_state_tracking_network_interface.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{nicConfig1-name}", + "properties": { + "disableTcpStateTracking": True, + "enableAcceleratedNetworking": True, + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + }, + { + "name": "{nicConfig2-name}", + "properties": { + "disableTcpStateTracking": False, + "enableAcceleratedNetworking": False, + "enableIPForwarding": False, + "ipConfigurations": [ + { + "name": "{nicConfig2-name}", + "properties": { + "primary": True, + "privateIPAddressVersion": "IPv4", + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name2}" + }, + }, + } + ], + "primary": False, + }, + }, + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithDisableTcpStateTrackingNetworkInterface.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithFpgaNetworkInterface.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithFpgaNetworkInterface.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithFpgaNetworkInterface.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithFpgaNetworkInterface.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithFpgaNetworkInterface.py new file mode 100644 index 00000000000..59bc0af5eac --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithFpgaNetworkInterface.py @@ -0,0 +1,101 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_from_with_fpga_network_interface.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + }, + { + "name": "{fpgaNic-Name}", + "properties": { + "enableAcceleratedNetworking": False, + "enableFpga": True, + "enableIPForwarding": False, + "ipConfigurations": [ + { + "name": "{fpgaNic-Name}", + "properties": { + "primary": True, + "privateIPAddressVersion": "IPv4", + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name}" + }, + }, + } + ], + "primary": False, + }, + }, + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithFpgaNetworkInterface.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithNetworkInterfaceWithDnsSettings.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithNetworkInterfaceWithDnsSettings.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithNetworkInterfaceWithDnsSettings.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithNetworkInterfaceWithDnsSettings.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithNetworkInterfaceWithDnsSettings.py new file mode 100644 index 00000000000..f30fa0eb260 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithNetworkInterfaceWithDnsSettings.py @@ -0,0 +1,117 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_from_with_network_interface_with_dns_settings.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{nicConfig1-name}", + "properties": { + "auxiliaryMode": "AcceleratedConnections", + "auxiliarySku": "A1", + "disableTcpStateTracking": True, + "enableAcceleratedNetworking": True, + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + "tags": {"nicTag": "tag"}, + }, + { + "name": "{nicConfig2-name}", + "properties": { + "disableTcpStateTracking": False, + "enableAcceleratedNetworking": False, + "enableIPForwarding": False, + "ipConfigurations": [ + { + "name": "{nicConfig2-name}", + "properties": { + "primary": True, + "privateIPAddressVersion": "IPv4", + "publicIPAddressConfiguration": { + "name": "publicip", + "properties": { + "dnsSettings": { + "domainNameLabel": "vmsstestlabel01", + "domainNameLabelScope": "NoReuse", + }, + "idleTimeoutInMinutes": 10, + }, + "tags": {"pipTag": "tag"}, + }, + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-fpga-subnet-name2}" + }, + }, + } + ], + "primary": False, + }, + }, + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_FromWithNetworkInterfaceWithDnsSettings.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_PlatformImageWithUnmanagedOsDisks.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_PlatformImageWithUnmanagedOsDisks.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_PlatformImageWithUnmanagedOsDisks.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_PlatformImageWithUnmanagedOsDisks.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_PlatformImageWithUnmanagedOsDisks.py new file mode 100644 index 00000000000..010237b8ba5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_PlatformImageWithUnmanagedOsDisks.py @@ -0,0 +1,90 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_platform_image_with_unmanaged_os_disks.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "name": "osDisk", + "vhdContainers": [ + "http://{existing-storage-account-name-0}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-1}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-2}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-3}.blob.core.windows.net/vhdContainer", + "http://{existing-storage-account-name-4}.blob.core.windows.net/vhdContainer", + ], + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_PlatformImageWithUnmanagedOsDisks.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAMarketplaceImagePlan.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAMarketplaceImagePlan.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAMarketplaceImagePlan.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAMarketplaceImagePlan.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAMarketplaceImagePlan.py new file mode 100644 index 00000000000..c6b32c72be4 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAMarketplaceImagePlan.py @@ -0,0 +1,84 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_amarketplace_image_plan.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "windows-data-science-vm", + "publisher": "microsoft-ads", + "sku": "windows2016", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAMarketplaceImagePlan.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithApplicationProfile.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithApplicationProfile.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithApplicationProfile.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithApplicationProfile.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithApplicationProfile.py new file mode 100644 index 00000000000..9f2253bc168 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithApplicationProfile.py @@ -0,0 +1,98 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_application_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "applicationProfile": { + "galleryApplications": [ + { + "configurationReference": "https://mystorageaccount.blob.core.windows.net/configurations/settings.config", + "enableAutomaticUpgrade": False, + "order": 1, + "packageReferenceId": "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdb/resourceGroups/myresourceGroupName2/providers/Microsoft.Compute/galleries/myGallery1/applications/MyApplication1/versions/1.0", + "tags": "myTag1", + "treatFailureAsDeploymentFailure": True, + }, + { + "packageReferenceId": "/subscriptions/32c17a9e-aa7b-4ba5-a45b-e324116b6fdg/resourceGroups/myresourceGroupName3/providers/Microsoft.Compute/galleries/myGallery2/applications/MyApplication2/versions/1.1" + }, + ] + }, + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithApplicationProfile.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticRepairs.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticRepairs.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticRepairs.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticRepairs.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticRepairs.py new file mode 100644 index 00000000000..824a798b7d1 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticRepairs.py @@ -0,0 +1,92 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_automatic_repairs.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "automaticRepairsPolicy": {"enabled": True, "gracePeriod": "PT10M"}, + "overprovision": True, + "scheduledEventsPolicy": { + "allInstancesDown": {"automaticallyApprove": True}, + "scheduledEventsAdditionalPublishingTargets": { + "eventGridAndResourceGraph": {"enable": True, "scheduledEventsApiVersion": "2020-07-01"} + }, + "userInitiatedReboot": {"automaticallyApprove": True}, + "userInitiatedRedeploy": {"automaticallyApprove": True}, + }, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticRepairs.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticZoneRebalancingPolicy.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticZoneRebalancingPolicy.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticZoneRebalancingPolicy.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticZoneRebalancingPolicy.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticZoneRebalancingPolicy.py new file mode 100644 index 00000000000..04118c9f4cf --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticZoneRebalancingPolicy.py @@ -0,0 +1,90 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_automatic_zone_rebalancing_policy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": False, + "resiliencyPolicy": { + "automaticZoneRebalancingPolicy": { + "enabled": True, + "rebalanceBehavior": "CreateBeforeDelete", + "rebalanceStrategy": "Recreate", + } + }, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAutomaticZoneRebalancingPolicy.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureApplicationGateway.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureApplicationGateway.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureApplicationGateway.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureApplicationGateway.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureApplicationGateway.py new file mode 100644 index 00000000000..6f50846a9a4 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureApplicationGateway.py @@ -0,0 +1,88 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_azure_application_gateway.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "applicationGatewayBackendAddressPools": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationGateways/{existing-application-gateway-name}/backendAddressPools/{existing-backend-address-pool-name}" + } + ], + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + }, + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureApplicationGateway.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureLoadBalancer.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureLoadBalancer.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureLoadBalancer.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureLoadBalancer.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureLoadBalancer.py new file mode 100644 index 00000000000..ab05ffc062e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureLoadBalancer.py @@ -0,0 +1,97 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_azure_load_balancer.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "loadBalancerBackendAddressPools": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/backendAddressPools/{existing-backend-address-pool-name}" + } + ], + "loadBalancerInboundNatPools": [ + { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/loadBalancers/{existing-load-balancer-name}/inboundNatPools/{existing-nat-pool-name}" + } + ], + "publicIPAddressConfiguration": { + "name": "{vmss-name}", + "properties": {"publicIPAddressVersion": "IPv4"}, + }, + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + }, + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithAzureLoadBalancer.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithBootDiagnostics.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithBootDiagnostics.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithBootDiagnostics.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithBootDiagnostics.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithBootDiagnostics.py new file mode 100644 index 00000000000..e8634a4008e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithBootDiagnostics.py @@ -0,0 +1,89 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_boot_diagnostics.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": True, + "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", + } + }, + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithBootDiagnostics.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithCapacityReservation.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithCapacityReservation.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithCapacityReservation.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithCapacityReservation.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithCapacityReservation.py new file mode 100644 index 00000000000..0e2e99bdaa6 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithCapacityReservation.py @@ -0,0 +1,88 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_capacity_reservation.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "capacityReservation": { + "capacityReservationGroup": { + "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/CapacityReservationGroups/{crgName}" + } + }, + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_DS1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithCapacityReservation.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiffOsDisk.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiffOsDisk.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiffOsDisk.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiffOsDisk.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiffOsDisk.py new file mode 100644 index 00000000000..6c09d3fbb48 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiffOsDisk.py @@ -0,0 +1,85 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_diff_os_disk.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "windows-data-science-vm", + "publisher": "microsoft-ads", + "sku": "windows2016", + "version": "latest", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "diffDiskSettings": {"option": "Local"}, + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_DS1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiffOsDisk.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskControllerType.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskControllerType.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskControllerType.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskControllerType.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskControllerType.py new file mode 100644 index 00000000000..fb7ad39cc8d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskControllerType.py @@ -0,0 +1,94 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_disk_controller_type.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "scheduledEventsPolicy": { + "allInstancesDown": {"automaticallyApprove": True}, + "scheduledEventsAdditionalPublishingTargets": { + "eventGridAndResourceGraph": {"enable": True, "scheduledEventsApiVersion": "2020-07-01"} + }, + "userInitiatedReboot": {"automaticallyApprove": True}, + "userInitiatedRedeploy": {"automaticallyApprove": True}, + }, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "hardwareProfile": {"vmSizeProperties": {"vCPUsAvailable": 1, "vCPUsPerCore": 1}}, + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "diskControllerType": "NVMe", + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + "userData": "RXhhbXBsZSBVc2VyRGF0YQ==", + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskControllerType.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskEncryptionSetResource.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskEncryptionSetResource.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskEncryptionSetResource.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskEncryptionSetResource.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskEncryptionSetResource.py new file mode 100644 index 00000000000..b40800066d8 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskEncryptionSetResource.py @@ -0,0 +1,99 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_disk_encryption_set_resource.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "dataDisks": [ + { + "caching": "ReadWrite", + "createOption": "Empty", + "diskSizeGB": 1023, + "lun": 0, + "managedDisk": { + "diskEncryptionSet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + "storageAccountType": "Standard_LRS", + }, + } + ], + "imageReference": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/images/{existing-custom-image-name}" + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": { + "diskEncryptionSet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + "storageAccountType": "Standard_LRS", + }, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_DS1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithDiskEncryptionSetResource.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEmptyDataDisksOnEachVm.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEmptyDataDisksOnEachVm.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEmptyDataDisksOnEachVm.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEmptyDataDisksOnEachVm.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEmptyDataDisksOnEachVm.py new file mode 100644 index 00000000000..d35ee9a1748 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEmptyDataDisksOnEachVm.py @@ -0,0 +1,88 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_empty_data_disks_on_each_vm.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "dataDisks": [ + {"createOption": "Empty", "diskSizeGB": 1023, "lun": 0}, + {"createOption": "Empty", "diskSizeGB": 1023, "lun": 1}, + ], + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "diskSizeGB": 512, + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D2_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEmptyDataDisksOnEachVm.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEncryptionAtHost.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEncryptionAtHost.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEncryptionAtHost.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEncryptionAtHost.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEncryptionAtHost.py new file mode 100644 index 00000000000..c58cc6b592c --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEncryptionAtHost.py @@ -0,0 +1,85 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_encryption_at_host.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "plan": {"name": "windows2016", "product": "windows-data-science-vm", "publisher": "microsoft-ads"}, + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "securityProfile": {"encryptionAtHost": True}, + "storageProfile": { + "imageReference": { + "offer": "windows-data-science-vm", + "publisher": "microsoft-ads", + "sku": "windows2016", + "version": "latest", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_DS1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithEncryptionAtHost.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsSuppressFailuresEnabled.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsSuppressFailuresEnabled.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsSuppressFailuresEnabled.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsSuppressFailuresEnabled.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsSuppressFailuresEnabled.py new file mode 100644 index 00000000000..8b484de7634 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsSuppressFailuresEnabled.py @@ -0,0 +1,104 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_extensions_suppress_failures_enabled.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": True, + "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", + } + }, + "extensionProfile": { + "extensions": [ + { + "name": "{extension-name}", + "properties": { + "autoUpgradeMinorVersion": False, + "publisher": "{extension-Publisher}", + "settings": {}, + "suppressFailures": True, + "type": "{extension-Type}", + "typeHandlerVersion": "{handler-version}", + }, + } + ] + }, + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsSuppressFailuresEnabled.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsTimeBudget.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsTimeBudget.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsTimeBudget.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsTimeBudget.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsTimeBudget.py new file mode 100644 index 00000000000..80336d0473d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsTimeBudget.py @@ -0,0 +1,104 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_extensions_time_budget.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": True, + "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", + } + }, + "extensionProfile": { + "extensions": [ + { + "name": "{extension-name}", + "properties": { + "autoUpgradeMinorVersion": False, + "publisher": "{extension-Publisher}", + "settings": {}, + "type": "{extension-Type}", + "typeHandlerVersion": "{handler-version}", + }, + } + ], + "extensionsTimeBudget": "PT1H20M", + }, + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithExtensionsTimeBudget.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithHighSpeedInterconnectPlacement.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithHighSpeedInterconnectPlacement.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithHighSpeedInterconnectPlacement.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithHighSpeedInterconnectPlacement.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithHighSpeedInterconnectPlacement.py new file mode 100644 index 00000000000..f652dec562d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithHighSpeedInterconnectPlacement.py @@ -0,0 +1,93 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_high_speed_interconnect_placement.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "highSpeedInterconnectPlacement": "None", + "orchestrationMode": "Flexible", + "platformFaultDomainCount": 1, + "virtualMachineProfile": { + "networkProfile": { + "networkApiVersion": "2020-11-01", + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableAcceleratedNetworking": False, + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "applicationGatewayBackendAddressPools": [], + "loadBalancerBackendAddressPools": [], + "primary": True, + "publicIPAddressConfiguration": { + "name": "{vmss-name}", + "properties": {"idleTimeoutInMinutes": 15}, + }, + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + }, + }, + } + ], + "primary": True, + }, + } + ], + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "0001-com-ubuntu-server-focal", + "publisher": "Canonical", + "sku": "20_04-lts-gen2", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 2, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithHighSpeedInterconnectPlacement.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithManagedBootDiagnostics.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithManagedBootDiagnostics.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithManagedBootDiagnostics.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithManagedBootDiagnostics.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithManagedBootDiagnostics.py new file mode 100644 index 00000000000..fcceeb6a573 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithManagedBootDiagnostics.py @@ -0,0 +1,84 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_managed_boot_diagnostics.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "diagnosticsProfile": {"bootDiagnostics": {"enabled": True}}, + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithManagedBootDiagnostics.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithMaxInstancePercentPerZonePolicy.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithMaxInstancePercentPerZonePolicy.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithMaxInstancePercentPerZonePolicy.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithMaxInstancePercentPerZonePolicy.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithMaxInstancePercentPerZonePolicy.py new file mode 100644 index 00000000000..e4092ebb3d6 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithMaxInstancePercentPerZonePolicy.py @@ -0,0 +1,86 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_max_instance_percent_per_zone_policy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": False, + "resiliencyPolicy": { + "zoneAllocationPolicy": {"maxInstancePercentPerZonePolicy": {"enabled": True, "value": 50}} + }, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithMaxInstancePercentPerZonePolicy.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithMaxZoneCount.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithMaxZoneCount.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithMaxZoneCount.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithMaxZoneCount.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithMaxZoneCount.py new file mode 100644 index 00000000000..f9d9f602b13 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithMaxZoneCount.py @@ -0,0 +1,85 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_max_zone_count.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "placement": {"zonePlacementPolicy": "Auto"}, + "properties": { + "overprovision": False, + "resiliencyPolicy": {"zoneAllocationPolicy": {"maxZoneCount": 2}}, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithMaxZoneCount.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithOSImageScheduledEventEnabled.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithOSImageScheduledEventEnabled.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithOSImageScheduledEventEnabled.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithOSImageScheduledEventEnabled.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithOSImageScheduledEventEnabled.py new file mode 100644 index 00000000000..dfc7c544778 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithOSImageScheduledEventEnabled.py @@ -0,0 +1,86 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_os_image_scheduled_event_enabled.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "scheduledEventsProfile": { + "osImageNotificationProfile": {"enable": True, "notBeforeTimeout": "PT15M"} + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithOSImageScheduledEventEnabled.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPasswordAuthentication.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPasswordAuthentication.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPasswordAuthentication.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPasswordAuthentication.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPasswordAuthentication.py new file mode 100644 index 00000000000..6ae9af1a11b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPasswordAuthentication.py @@ -0,0 +1,83 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_password_authentication.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPasswordAuthentication.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPlacement.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPlacement.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPlacement.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPlacement.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPlacement.py new file mode 100644 index 00000000000..da78579a729 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPlacement.py @@ -0,0 +1,84 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_placement.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "placement": {"includeZones": ["1", "3"], "zonePlacementPolicy": "Auto"}, + "properties": { + "overprovision": False, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPlacement.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPremiumStorage.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPremiumStorage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPremiumStorage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPremiumStorage.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPremiumStorage.py new file mode 100644 index 00000000000..0c3cb0db818 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPremiumStorage.py @@ -0,0 +1,83 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_premium_storage.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Premium_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPremiumStorage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPriorityMixPolicy.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPriorityMixPolicy.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPriorityMixPolicy.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPriorityMixPolicy.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPriorityMixPolicy.py new file mode 100644 index 00000000000..d12ca8a3c44 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPriorityMixPolicy.py @@ -0,0 +1,90 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_priority_mix_policy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "orchestrationMode": "Flexible", + "platformFaultDomainCount": 1, + "priorityMixPolicy": {"baseRegularPriorityCount": 10, "regularPriorityPercentageAboveBase": 50}, + "virtualMachineProfile": { + "networkProfile": { + "networkApiVersion": "2020-11-01", + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableAcceleratedNetworking": False, + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "applicationGatewayBackendAddressPools": [], + "loadBalancerBackendAddressPools": [], + "primary": True, + "publicIPAddressConfiguration": { + "name": "{vmss-name}", + "properties": {"idleTimeoutInMinutes": 15}, + }, + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + }, + }, + } + ], + "primary": True, + }, + } + ], + }, + "osProfile": {"adminUsername": "{your-username}", "computerNamePrefix": "{vmss-name}"}, + "priority": "Spot", + "storageProfile": { + "imageReference": { + "offer": "0001-com-ubuntu-server-focal", + "publisher": "Canonical", + "sku": "20_04-lts-gen2", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 2, "name": "Standard_A8m_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithPriorityMixPolicy.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProtectedSettingsFromKeyVault.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProtectedSettingsFromKeyVault.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProtectedSettingsFromKeyVault.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProtectedSettingsFromKeyVault.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProtectedSettingsFromKeyVault.py new file mode 100644 index 00000000000..d1224ab097d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProtectedSettingsFromKeyVault.py @@ -0,0 +1,109 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_protected_settings_from_key_vault.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": True, + "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", + } + }, + "extensionProfile": { + "extensions": [ + { + "name": "{extension-name}", + "properties": { + "autoUpgradeMinorVersion": False, + "protectedSettingsFromKeyVault": { + "secretUrl": "https://kvName.vault.azure.net/secrets/secretName/79b88b3a6f5440ffb2e73e44a0db712e", + "sourceVault": { + "id": "/subscriptions/a53f7094-a16c-47af-abe4-b05c05d0d79a/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/kvName" + }, + }, + "publisher": "{extension-Publisher}", + "settings": {}, + "type": "{extension-Type}", + "typeHandlerVersion": "{handler-version}", + }, + } + ] + }, + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProtectedSettingsFromKeyVault.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProxyAgentSettings.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProxyAgentSettings.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProxyAgentSettings.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProxyAgentSettings.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProxyAgentSettings.py new file mode 100644 index 00000000000..99e78a6ec80 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProxyAgentSettings.py @@ -0,0 +1,91 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_proxy_agent_settings.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": {"adminUsername": "{your-username}", "computerNamePrefix": "{vmss-name}"}, + "securityProfile": { + "proxyAgentSettings": { + "addProxyAgentExtension": True, + "enabled": True, + "imds": { + "inVMAccessControlProfileReferenceId": "/subscriptions/{sub-id}/resourceGroups/{rg}/providers/Microsoft.Compute/galleries/{gallery-name}/inVMAccessControlProfiles/{profile-name}/versions/{version}" + }, + "wireServer": { + "inVMAccessControlProfileReferenceId": "/subscriptions/{sub-id}/resourceGroups/{rg}/providers/Microsoft.Compute/galleries/{gallery-name}/inVMAccessControlProfiles/{profile-name}/versions/{version}" + }, + } + }, + "storageProfile": { + "imageReference": { + "offer": "0001-com-ubuntu-server-jammy", + "publisher": "Canonical", + "sku": "22_04-lts-gen2", + "version": "latest", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "StandardSSD_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D2s_v3", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithProxyAgentSettings.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMCreationPolicy.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMCreationPolicy.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMCreationPolicy.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMCreationPolicy.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMCreationPolicy.py new file mode 100644 index 00000000000..5f6ccc48e0d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMCreationPolicy.py @@ -0,0 +1,84 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_resilient_vm_creation_policy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": False, + "resiliencyPolicy": {"resilientVMCreationPolicy": {"enabled": True}}, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMCreationPolicy.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMDeletionPolicy.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMDeletionPolicy.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMDeletionPolicy.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMDeletionPolicy.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMDeletionPolicy.py new file mode 100644 index 00000000000..0454063e907 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMDeletionPolicy.py @@ -0,0 +1,84 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_resilient_vm_deletion_policy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": False, + "resiliencyPolicy": {"resilientVMDeletionPolicy": {"enabled": True}}, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithResilientVMDeletionPolicy.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithScaleInPolicy.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithScaleInPolicy.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithScaleInPolicy.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithScaleInPolicy.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithScaleInPolicy.py new file mode 100644 index 00000000000..15979afc9b3 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithScaleInPolicy.py @@ -0,0 +1,84 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_scale_in_policy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "scaleInPolicy": {"forceDeletion": True, "prioritizeUnhealthyVMs": True, "rules": ["OldestVM"]}, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithScaleInPolicy.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityPostureReference.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityPostureReference.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityPostureReference.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityPostureReference.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityPostureReference.py new file mode 100644 index 00000000000..75052b8d614 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityPostureReference.py @@ -0,0 +1,82 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_security_posture_reference.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "eastus2euap", + "properties": { + "overprovision": True, + "upgradePolicy": {"automaticOSUpgradePolicy": {"enableAutomaticOSUpgrade": True}, "mode": "Automatic"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "securityPostureReference": { + "id": "/CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|{major.*}|latest" + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2022-Datacenter", + "version": "latest", + }, + "osDisk": {"caching": "ReadWrite", "createOption": "FromImage", "name": "osDisk"}, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_A1", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityPostureReference.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVM.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVM.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVM.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVM.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVM.py new file mode 100644 index 00000000000..caba6e55a6d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVM.py @@ -0,0 +1,90 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_security_type_confidential_vm.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "securityProfile": { + "securityType": "ConfidentialVM", + "uefiSettings": {"secureBootEnabled": True, "vTpmEnabled": True}, + }, + "storageProfile": { + "imageReference": { + "offer": "2019-datacenter-cvm", + "publisher": "MicrosoftWindowsServer", + "sku": "windows-cvm", + "version": "17763.2183.2109130127", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "managedDisk": { + "securityProfile": {"securityEncryptionType": "VMGuestStateOnly"}, + "storageAccountType": "StandardSSD_LRS", + }, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_DC2as_v5", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVM.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.py new file mode 100644 index 00000000000..d2fc36d896b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.py @@ -0,0 +1,90 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_security_type_confidential_vm_with_non_persisted_tpm.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "securityProfile": { + "securityType": "ConfidentialVM", + "uefiSettings": {"secureBootEnabled": False, "vTpmEnabled": True}, + }, + "storageProfile": { + "imageReference": { + "offer": "2022-datacenter-cvm", + "publisher": "UbuntuServer", + "sku": "linux-cvm", + "version": "17763.2183.2109130127", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "managedDisk": { + "securityProfile": {"securityEncryptionType": "NonPersistedTPM"}, + "storageAccountType": "StandardSSD_LRS", + }, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_DC2es_v5", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSecurityTypeConfidentialVMWithNonPersistedTPM.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithServiceArtifactReference.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithServiceArtifactReference.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithServiceArtifactReference.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithServiceArtifactReference.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithServiceArtifactReference.py new file mode 100644 index 00000000000..510f5f83589 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithServiceArtifactReference.py @@ -0,0 +1,82 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_service_artifact_reference.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "eastus2euap", + "properties": { + "overprovision": True, + "upgradePolicy": {"automaticOSUpgradePolicy": {"enableAutomaticOSUpgrade": True}, "mode": "Automatic"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "serviceArtifactReference": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/serviceArtifacts/serviceArtifactName/vmArtifactsProfiles/vmArtifactsProfilesName" + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2022-Datacenter", + "version": "latest", + }, + "osDisk": {"caching": "ReadWrite", "createOption": "FromImage", "name": "osDisk"}, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_A1", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithServiceArtifactReference.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSkuProfile.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSkuProfile.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSkuProfile.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSkuProfile.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSkuProfile.py new file mode 100644 index 00000000000..e47f5f6e894 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSkuProfile.py @@ -0,0 +1,91 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_sku_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "orchestrationMode": "Flexible", + "priorityMixPolicy": {"baseRegularPriorityCount": 4, "regularPriorityPercentageAboveBase": 50}, + "singlePlacementGroup": False, + "skuProfile": { + "allocationStrategy": "CapacityOptimized", + "vmSizes": [{"name": "Standard_D8s_v5"}, {"name": "Standard_E16s_v5"}, {"name": "Standard_D2s_v5"}], + }, + "virtualMachineProfile": { + "billingProfile": {"maxPrice": -1}, + "evictionPolicy": "Deallocate", + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "priority": "Spot", + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 10, "name": "Mix"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSkuProfile.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSkuProfile_Prioritized.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSkuProfile_Prioritized.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSkuProfile_Prioritized.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSkuProfile_Prioritized.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSkuProfile_Prioritized.py new file mode 100644 index 00000000000..840ce5c640e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSkuProfile_Prioritized.py @@ -0,0 +1,95 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_sku_profile_prioritized.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "orchestrationMode": "Flexible", + "priorityMixPolicy": {"baseRegularPriorityCount": 4, "regularPriorityPercentageAboveBase": 50}, + "singlePlacementGroup": False, + "skuProfile": { + "allocationStrategy": "Prioritized", + "vmSizes": [ + {"name": "Standard_D8s_v5", "rank": 0}, + {"name": "Standard_E16s_v5", "rank": 1}, + {"name": "Standard_D2s_v5", "rank": 2}, + ], + }, + "virtualMachineProfile": { + "billingProfile": {"maxPrice": -1}, + "evictionPolicy": "Deallocate", + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "priority": "Spot", + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 10, "name": "Mix"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSkuProfile_Prioritized.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSpotRestorePolicy.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSpotRestorePolicy.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSpotRestorePolicy.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSpotRestorePolicy.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSpotRestorePolicy.py new file mode 100644 index 00000000000..f2214263dcf --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSpotRestorePolicy.py @@ -0,0 +1,87 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_spot_restore_policy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "spotRestorePolicy": {"enabled": True, "restoreTimeout": "PT1H"}, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "billingProfile": {"maxPrice": -1}, + "evictionPolicy": "Deallocate", + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "priority": "Spot", + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 2, "name": "Standard_A8m_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSpotRestorePolicy.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSshAuthentication.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSshAuthentication.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSshAuthentication.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSshAuthentication.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSshAuthentication.py new file mode 100644 index 00000000000..23093b0c5cd --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSshAuthentication.py @@ -0,0 +1,93 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_ssh_authentication.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + "linuxConfiguration": { + "disablePasswordAuthentication": True, + "ssh": { + "publicKeys": [ + { + "keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1", + "path": "/home/{your-username}/.ssh/authorized_keys", + } + ] + }, + }, + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithSshAuthentication.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithTerminateScheduledEventEnabled.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithTerminateScheduledEventEnabled.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithTerminateScheduledEventEnabled.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithTerminateScheduledEventEnabled.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithTerminateScheduledEventEnabled.py new file mode 100644 index 00000000000..a7f89b34982 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithTerminateScheduledEventEnabled.py @@ -0,0 +1,86 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_terminate_scheduled_event_enabled.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "scheduledEventsProfile": { + "terminateNotificationProfile": {"enable": True, "notBeforeTimeout": "PT5M"} + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithTerminateScheduledEventEnabled.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUefiSettings.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUefiSettings.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUefiSettings.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUefiSettings.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUefiSettings.py new file mode 100644 index 00000000000..a51f3fd85f6 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUefiSettings.py @@ -0,0 +1,87 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_uefi_settings.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "securityProfile": { + "securityType": "TrustedLaunch", + "uefiSettings": {"secureBootEnabled": True, "vTpmEnabled": True}, + }, + "storageProfile": { + "imageReference": { + "offer": "windowsserver-gen2preview-preview", + "publisher": "MicrosoftWindowsServer", + "sku": "windows10-tvm", + "version": "18363.592.2001092016", + }, + "osDisk": { + "caching": "ReadOnly", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "StandardSSD_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 3, "name": "Standard_D2s_v3", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUefiSettings.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUserData.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUserData.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUserData.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUserData.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUserData.py new file mode 100644 index 00000000000..85ee338bad5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUserData.py @@ -0,0 +1,84 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_user_data.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + "userData": "RXhhbXBsZSBVc2VyRGF0YQ==", + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithUserData.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMSizeProperties.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMSizeProperties.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMSizeProperties.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMSizeProperties.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMSizeProperties.py new file mode 100644 index 00000000000..8b2df635a69 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMSizeProperties.py @@ -0,0 +1,85 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_vm_size_properties.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "hardwareProfile": {"vmSizeProperties": {"vCPUsAvailable": 1, "vCPUsPerCore": 1}}, + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + "userData": "RXhhbXBsZSBVc2VyRGF0YQ==", + }, + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMSizeProperties.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMsInDifferentZones.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMsInDifferentZones.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMsInDifferentZones.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMsInDifferentZones.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMsInDifferentZones.py new file mode 100644 index 00000000000..4c0a9e50153 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMsInDifferentZones.py @@ -0,0 +1,89 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_vms_in_different_zones.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "centralus", + "properties": { + "overprovision": True, + "upgradePolicy": {"mode": "Automatic"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "dataDisks": [ + {"createOption": "Empty", "diskSizeGB": 1023, "lun": 0}, + {"createOption": "Empty", "diskSizeGB": 1023, "lun": 1}, + ], + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "diskSizeGB": 512, + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + }, + "sku": {"capacity": 2, "name": "Standard_A1_v2", "tier": "Standard"}, + "zones": ["1", "3"], + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithVMsInDifferentZones.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithZonalPlatformFaultDomainAlignMode.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithZonalPlatformFaultDomainAlignMode.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithZonalPlatformFaultDomainAlignMode.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithZonalPlatformFaultDomainAlignMode.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithZonalPlatformFaultDomainAlignMode.py new file mode 100644 index 00000000000..23afabd79cc --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithZonalPlatformFaultDomainAlignMode.py @@ -0,0 +1,89 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_create_with_zonal_platform_fault_domain_align_mode.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={ + "location": "westus", + "properties": { + "overprovision": True, + "scheduledEventsPolicy": { + "scheduledEventsAdditionalPublishingTargets": {"eventGridAndResourceGraph": {"enable": True}}, + "userInitiatedReboot": {"automaticallyApprove": True}, + "userInitiatedRedeploy": {"automaticallyApprove": True}, + }, + "upgradePolicy": {"mode": "Manual"}, + "virtualMachineProfile": { + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "{vmss-name}", + "properties": { + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/{existing-virtual-network-name}/subnets/{existing-subnet-name}" + } + }, + } + ], + "primary": True, + }, + } + ] + }, + "osProfile": { + "adminPassword": "{your-password}", + "adminUsername": "{your-username}", + "computerNamePrefix": "{vmss-name}", + }, + "storageProfile": { + "imageReference": { + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "createOption": "FromImage", + "managedDisk": {"storageAccountType": "Standard_LRS"}, + }, + }, + }, + "zonalPlatformFaultDomainAlignMode": "Aligned", + }, + "sku": {"capacity": 3, "name": "Standard_D1_v2", "tier": "Standard"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Create_WithZonalPlatformFaultDomainAlignMode.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MaximumSet_Gen.py new file mode 100644 index 00000000000..e4000e1c131 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_deallocate_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_deallocate( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MinimumSet_Gen.py new file mode 100644 index 00000000000..c6f7a0a0193 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_deallocate_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_deallocate( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Deallocate_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Delete_Force.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Delete_Force.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Delete_Force.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Delete_Force.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Delete_Force.py new file mode 100644 index 00000000000..7e11f83b74d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Delete_Force.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_delete_force.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_delete( + resource_group_name="myResourceGroup", + vm_scale_set_name="myvmScaleSet", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Delete_Force.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MaximumSet_Gen.py new file mode 100644 index 00000000000..9c740f80ca5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MaximumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.force_recovery_service_fabric_platform_update_domain_walk( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaa", + platform_update_domain=30, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MinimumSet_Gen.py new file mode 100644 index 00000000000..0e41381847b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MinimumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_force_recovery_service_fabric_platform_update_domain_walk_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.force_recovery_service_fabric_platform_update_domain_walk( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaa", + platform_update_domain=9, + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ForceRecoveryServiceFabricPlatformUpdateDomainWalk_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get.py new file mode 100644 index 00000000000..753f391b87d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.get( + resource_group_name="myResourceGroup", + vm_scale_set_name="myVirtualMachineScaleSet", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MaximumSet_Gen.py new file mode 100644 index 00000000000..4493421bcdb --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_get_instance_view_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.get_instance_view( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MinimumSet_Gen.py new file mode 100644 index 00000000000..f14a5224361 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_get_instance_view_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.get_instance_view( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaa", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetInstanceView_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MaximumSet_Gen.py new file mode 100644 index 00000000000..fd3dbefb2a3 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MaximumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_get_os_upgrade_history_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.get_os_upgrade_history( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaa", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MinimumSet_Gen.py new file mode 100644 index 00000000000..558d015167b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MinimumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_get_os_upgrade_history_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.get_os_upgrade_history( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaa", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_GetOSUpgradeHistory_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_AutoPlacedOnDedicatedHostGroup.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_AutoPlacedOnDedicatedHostGroup.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_AutoPlacedOnDedicatedHostGroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_AutoPlacedOnDedicatedHostGroup.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_AutoPlacedOnDedicatedHostGroup.py new file mode 100644 index 00000000000..660a782a687 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_AutoPlacedOnDedicatedHostGroup.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_get_auto_placed_on_dedicated_host_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.get( + resource_group_name="myResourceGroup", + vm_scale_set_name="myVirtualMachineScaleSet", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_AutoPlacedOnDedicatedHostGroup.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithDiskControllerType.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithDiskControllerType.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithDiskControllerType.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithDiskControllerType.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithDiskControllerType.py new file mode 100644 index 00000000000..b8d89293b00 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithDiskControllerType.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_get_with_disk_controller_type.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.get( + resource_group_name="myResourceGroup", + vm_scale_set_name="myVirtualMachineScaleSet", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithDiskControllerType.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithUserData.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithUserData.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithUserData.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithUserData.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithUserData.py new file mode 100644 index 00000000000..60060bb2952 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithUserData.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_get_with_user_data.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.get( + resource_group_name="myResourceGroup", + vm_scale_set_name="myVirtualMachineScaleSet", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Get_WithUserData.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MaximumSet_Gen.py new file mode 100644 index 00000000000..e894ce0eb85 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MaximumSet_Gen.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_list_all_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.list_all() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MinimumSet_Gen.py new file mode 100644 index 00000000000..db394a2215f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MinimumSet_Gen.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_list_all_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.list_all() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListAll_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListBySubscription_ByLocation.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListBySubscription_ByLocation.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListBySubscription_ByLocation.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListBySubscription_ByLocation.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListBySubscription_ByLocation.py new file mode 100644 index 00000000000..e04dc032bab --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListBySubscription_ByLocation.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_list_by_subscription_by_location.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.list_by_location( + location="eastus", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListBySubscription_ByLocation.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MaximumSet_Gen.py new file mode 100644 index 00000000000..ae9404631a4 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MaximumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_list_skus_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.list_skus( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaa", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MinimumSet_Gen.py new file mode 100644 index 00000000000..771d35a2578 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MinimumSet_Gen.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_list_skus_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.list_skus( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaa", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ListSkus_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MaximumSet_Gen.py new file mode 100644 index 00000000000..9057a3acb04 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_list_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.list( + resource_group_name="rgcompute", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MinimumSet_Gen.py new file mode 100644 index 00000000000..3097a7cb2c6 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_list_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.list( + resource_group_name="rgcompute", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_List_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MaximumSet_Gen.py new file mode 100644 index 00000000000..fedf03b9928 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_perform_maintenance_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_perform_maintenance( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MinimumSet_Gen.py new file mode 100644 index 00000000000..00024ab1304 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_perform_maintenance_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_perform_maintenance( + resource_group_name="rgcompute", + vm_scale_set_name="aa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PerformMaintenance_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MaximumSet_Gen.py new file mode 100644 index 00000000000..f809f2b34c0 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_power_off_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_power_off( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MinimumSet_Gen.py new file mode 100644 index 00000000000..c90b47e3cf2 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_power_off_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_power_off( + resource_group_name="rgcompute", + vm_scale_set_name="a", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_PowerOff_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MaximumSet_Gen.py new file mode 100644 index 00000000000..0f49f8dd581 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_reapply_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="b4f1213b-cacc-4816-8bfb-f30f90643de8", + ) + + client.virtual_machine_scale_sets.begin_reapply( + resource_group_name="VirtualMachineScaleSetReapplyTestRG", + vm_scale_set_name="VMSSReapply-Test-ScaleSet", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MinimumSet_Gen.py new file mode 100644 index 00000000000..070af70144f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_reapply_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="b4f1213b-cacc-4816-8bfb-f30f90643de8", + ) + + client.virtual_machine_scale_sets.begin_reapply( + resource_group_name="VirtualMachineScaleSetReapplyTestRG", + vm_scale_set_name="VMSSReapply-Test-ScaleSet", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reapply_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MaximumSet_Gen.py new file mode 100644 index 00000000000..26e82161ad7 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_redeploy_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_redeploy( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MinimumSet_Gen.py new file mode 100644 index 00000000000..458ec907ffc --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_redeploy_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_redeploy( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Redeploy_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MaximumSet_Gen.py new file mode 100644 index 00000000000..e35358d83e5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_reimage_all_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_reimage_all( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MinimumSet_Gen.py new file mode 100644 index 00000000000..486faf630c7 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_reimage_all_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_reimage_all( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ReimageAll_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MaximumSet_Gen.py new file mode 100644 index 00000000000..da0c0673ea2 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_reimage_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_reimage( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MinimumSet_Gen.py new file mode 100644 index 00000000000..67cf2c5e1d3 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_reimage_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_reimage( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Reimage_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MaximumSet_Gen.py new file mode 100644 index 00000000000..69398b78132 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_restart_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_restart( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MinimumSet_Gen.py new file mode 100644 index 00000000000..9c434994154 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_restart_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_restart( + resource_group_name="rgcompute", + vm_scale_set_name="aaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Restart_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ScaleOut.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ScaleOut.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ScaleOut.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ScaleOut.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ScaleOut.py new file mode 100644 index 00000000000..45428879fbf --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ScaleOut.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_scale_out.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_scale_out( + resource_group_name="myResourceGroup", + vm_scale_set_name="{vmss-name}", + parameters={"capacity": 5, "properties": {"zone": "1"}}, + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_ScaleOut.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MaximumSet_Gen.py new file mode 100644 index 00000000000..3f99b70ef4b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MaximumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_set_orchestration_service_state_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_set_orchestration_service_state( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaa", + parameters={"action": "Resume", "serviceName": "AutomaticRepairs"}, + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MinimumSet_Gen.py new file mode 100644 index 00000000000..2866ea97b0f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MinimumSet_Gen.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_set_orchestration_service_state_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_set_orchestration_service_state( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaa", + parameters={"action": "Resume", "serviceName": "AutomaticRepairs"}, + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_SetOrchestrationServiceState_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MaximumSet_Gen.py new file mode 100644 index 00000000000..b2fb370bcd7 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MaximumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_start_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_start( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MinimumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MinimumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MinimumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MinimumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MinimumSet_Gen.py new file mode 100644 index 00000000000..55ef3341558 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MinimumSet_Gen.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_start_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.virtual_machine_scale_sets.begin_start( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaaaaaaaa", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Start_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Update_MaximumSet_Gen.json b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Update_MaximumSet_Gen.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Update_MaximumSet_Gen.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Update_MaximumSet_Gen.py b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Update_MaximumSet_Gen.py new file mode 100644 index 00000000000..f3209b91200 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples-python/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Update_MaximumSet_Gen.py @@ -0,0 +1,262 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python virtual_machine_scale_set_update_maximum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.virtual_machine_scale_sets.begin_update( + resource_group_name="rgcompute", + vm_scale_set_name="aaaaaaaaaaaaa", + parameters={ + "identity": {"type": "SystemAssigned", "userAssignedIdentities": {"key3951": {}}}, + "plan": { + "name": "windows2016", + "product": "windows-data-science-vm", + "promotionCode": "aaaaaaaaaa", + "publisher": "microsoft-ads", + }, + "properties": { + "additionalCapabilities": {"hibernationEnabled": True, "ultraSSDEnabled": True}, + "automaticRepairsPolicy": {"enabled": True, "gracePeriod": "PT30M"}, + "doNotRunExtensionsOnOverprovisionedVMs": True, + "overprovision": True, + "proximityPlacementGroup": { + "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" + }, + "scaleInPolicy": {"forceDeletion": True, "rules": ["OldestVM"]}, + "singlePlacementGroup": True, + "upgradePolicy": { + "automaticOSUpgradePolicy": { + "disableAutomaticRollback": True, + "enableAutomaticOSUpgrade": True, + "osRollingUpgradeDeferral": True, + }, + "mode": "Manual", + "rollingUpgradePolicy": { + "enableCrossZoneUpgrade": True, + "maxBatchInstancePercent": 49, + "maxSurge": True, + "maxUnhealthyInstancePercent": 81, + "maxUnhealthyUpgradedInstancePercent": 98, + "pauseTimeBetweenBatches": "aaaaaaaaaaaaaaa", + "prioritizeUnhealthyInstances": True, + "rollbackFailedInstancesOnPolicyBreach": True, + }, + }, + "virtualMachineProfile": { + "billingProfile": {"maxPrice": -1}, + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": True, + "storageUri": "http://{existing-storage-account-name}.blob.core.windows.net", + } + }, + "extensionProfile": { + "extensions": [ + { + "name": "{extension-name}", + "properties": { + "autoUpgradeMinorVersion": True, + "enableAutomaticUpgrade": True, + "forceUpdateTag": "aaaaaaaaa", + "protectedSettings": {}, + "provisionAfterExtensions": ["aa"], + "publisher": "{extension-Publisher}", + "settings": {}, + "suppressFailures": True, + "type": "{extension-Type}", + "typeHandlerVersion": "{handler-version}", + }, + } + ], + "extensionsTimeBudget": "PT1H20M", + }, + "licenseType": "aaaaaaaaaaaa", + "networkProfile": { + "healthProbe": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123" + }, + "networkApiVersion": "2020-11-01", + "networkInterfaceConfigurations": [ + { + "name": "aaaaaaaa", + "properties": { + "deleteOption": "Delete", + "dnsSettings": {"dnsServers": []}, + "enableAcceleratedNetworking": True, + "enableFpga": True, + "enableIPForwarding": True, + "ipConfigurations": [ + { + "name": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa", + "properties": { + "applicationGatewayBackendAddressPools": [ + { + "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" + } + ], + "applicationSecurityGroups": [ + { + "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" + } + ], + "loadBalancerBackendAddressPools": [ + { + "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" + } + ], + "loadBalancerInboundNatPools": [ + { + "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" + } + ], + "primary": True, + "privateIPAddressVersion": "IPv4", + "publicIPAddressConfiguration": { + "name": "a", + "properties": { + "deleteOption": "Delete", + "dnsSettings": {"domainNameLabel": "aaaaaaaaaaaaaaaaaa"}, + "idleTimeoutInMinutes": 3, + }, + }, + "subnet": { + "id": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/disk123" + }, + }, + } + ], + "networkSecurityGroup": { + "id": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot" + }, + "primary": True, + }, + } + ], + }, + "osProfile": { + "customData": "aaaaaaaaaaaaaaaaaaaaaaaaaa", + "linuxConfiguration": { + "disablePasswordAuthentication": True, + "patchSettings": {"assessmentMode": "ImageDefault", "patchMode": "ImageDefault"}, + "provisionVMAgent": True, + "ssh": { + "publicKeys": [ + { + "keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeClRAk2ipUs/l5voIsDC5q9RI+YSRd1Bvd/O+axgY4WiBzG+4FwJWZm/mLLe5DoOdHQwmU2FrKXZSW4w2sYE70KeWnrFViCOX5MTVvJgPE8ClugNl8RWth/tU849DvM9sT7vFgfVSHcAS2yDRyDlueii+8nF2ym8XWAPltFVCyLHRsyBp5YPqK8JFYIa1eybKsY3hEAxRCA+/7bq8et+Gj3coOsuRmrehav7rE6N12Pb80I6ofa6SM5XNYq4Xk0iYNx7R3kdz0Jj9XgZYWjAHjJmT0gTRoOnt6upOuxK7xI/ykWrllgpXrCPu3Ymz+c+ujaqcxDopnAl2lmf69/J1", + "path": "/home/{your-username}/.ssh/authorized_keys", + } + ] + }, + }, + "secrets": [ + { + "sourceVault": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" + }, + "vaultCertificates": [ + {"certificateStore": "aaaaaaaaaaaaaaaaaaaaaaaaa", "certificateUrl": "aaaaaaa"} + ], + } + ], + "windowsConfiguration": { + "additionalUnattendContent": [ + { + "componentName": "Microsoft-Windows-Shell-Setup", + "content": "aaaaaaaaaaaaaaaaaaaa", + "passName": "OobeSystem", + "settingName": "AutoLogon", + } + ], + "enableAutomaticUpdates": True, + "patchSettings": { + "assessmentMode": "ImageDefault", + "automaticByPlatformSettings": {"rebootSetting": "Never"}, + "enableHotpatching": True, + "patchMode": "AutomaticByPlatform", + }, + "provisionVMAgent": True, + "timeZone": "aaaaaaaaaaaaaaaa", + "winRM": {"listeners": [{"certificateUrl": "aaaaaaaaaaaaaaaaaaaaaa", "protocol": "Http"}]}, + }, + }, + "scheduledEventsProfile": { + "terminateNotificationProfile": {"enable": True, "notBeforeTimeout": "PT10M"} + }, + "securityProfile": { + "encryptionAtHost": True, + "securityType": "TrustedLaunch", + "uefiSettings": {"secureBootEnabled": True, "vTpmEnabled": True}, + }, + "storageProfile": { + "dataDisks": [ + { + "caching": "None", + "createOption": "Empty", + "diskIOPSReadWrite": 28, + "diskMBpsReadWrite": 15, + "diskSizeGB": 1023, + "lun": 26, + "managedDisk": { + "diskEncryptionSet": {"id": "aaaaaaaaaaaa"}, + "storageAccountType": "Standard_LRS", + }, + "name": "aaaaaaaaaaaaaaaaaaaaaaaaaa", + "writeAcceleratorEnabled": True, + } + ], + "imageReference": { + "id": "aaaaaaaaaaaaaaaaaaa", + "offer": "WindowsServer", + "publisher": "MicrosoftWindowsServer", + "sharedGalleryImageId": "aaaaaa", + "sku": "2016-Datacenter", + "version": "latest", + }, + "osDisk": { + "caching": "ReadWrite", + "diffDiskSettings": {"option": "Local", "placement": "CacheDisk"}, + "diskSizeGB": 6, + "image": { + "uri": "http://{existing-storage-account-name}.blob.core.windows.net/{existing-container-name}/myDisk.vhd" + }, + "managedDisk": { + "diskEncryptionSet": {"id": "aaaaaaaaaaaa"}, + "storageAccountType": "Standard_LRS", + }, + "vhdContainers": ["aa"], + "writeAcceleratorEnabled": True, + }, + }, + "userData": "aaaaaaaaaaaaa", + }, + }, + "sku": {"capacity": 7, "name": "DSv3-Type1", "tier": "aaa"}, + "tags": {"key246": "aaaaaaaaaaaaaaaaaaaaaaaa"}, + "zones": ["1", "2", "3"], + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/ComputeRP/stable/2025-04-01/examples/virtualMachineScaleSetExamples/VirtualMachineScaleSet_Update_MaximumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Approve.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Approve.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Approve.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Approve.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Approve.py new file mode 100644 index 00000000000..49293ff4d2b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Approve.py @@ -0,0 +1,43 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_access_private_endpoint_connection_approve.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_accesses.begin_update_a_private_endpoint_connection( + resource_group_name="myResourceGroup", + disk_access_name="myDiskAccess", + private_endpoint_connection_name="myPrivateEndpointConnection", + private_endpoint_connection={ + "properties": { + "privateLinkServiceConnectionState": { + "description": "Approving myPrivateEndpointConnection", + "status": "Approved", + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Approve.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Delete.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Delete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Delete.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Delete.py new file mode 100644 index 00000000000..a1a3face82a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Delete.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_access_private_endpoint_connection_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.disk_accesses.begin_delete_a_private_endpoint_connection( + resource_group_name="myResourceGroup", + disk_access_name="myDiskAccess", + private_endpoint_connection_name="myPrivateEndpointConnection", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Delete.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Get.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Get.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Get.py new file mode 100644 index 00000000000..3a2af2af188 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_Get.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_access_private_endpoint_connection_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_accesses.get_a_private_endpoint_connection( + resource_group_name="myResourceGroup", + disk_access_name="myDiskAccess", + private_endpoint_connection_name="myPrivateEndpointConnection", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_ListByDiskAccess.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_ListByDiskAccess.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_ListByDiskAccess.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_ListByDiskAccess.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_ListByDiskAccess.py new file mode 100644 index 00000000000..05d000da6a2 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateEndpointConnection_ListByDiskAccess.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_access_private_endpoint_connection_list_by_disk_access.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_accesses.list_private_endpoint_connections( + resource_group_name="myResourceGroup", + disk_access_name="myDiskAccess", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccessPrivateEndpointConnection_ListByDiskAccess.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateLinkResources_Get.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateLinkResources_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateLinkResources_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateLinkResources_Get.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateLinkResources_Get.py new file mode 100644 index 00000000000..f36697faae4 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccessPrivateLinkResources_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_access_private_link_resources_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_accesses.get_private_link_resources( + resource_group_name="myResourceGroup", + disk_access_name="myDiskAccess", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccessPrivateLinkResources_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Create.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Create.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Create.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Create.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Create.py new file mode 100644 index 00000000000..dfb74540276 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Create.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_access_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_accesses.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_access_name="myDiskAccess", + disk_access={"location": "West US"}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_Create.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Delete.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Delete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Delete.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Delete.py new file mode 100644 index 00000000000..a7296df183a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Delete.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_access_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.disk_accesses.begin_delete( + resource_group_name="myResourceGroup", + disk_access_name="myDiskAccess", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_Delete.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Get.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Get.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Get.py new file mode 100644 index 00000000000..d38f0aebd36 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_access_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_accesses.get( + resource_group_name="myResourceGroup", + disk_access_name="myDiskAccess", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Get_WithPrivateEndpoints.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Get_WithPrivateEndpoints.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Get_WithPrivateEndpoints.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Get_WithPrivateEndpoints.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Get_WithPrivateEndpoints.py new file mode 100644 index 00000000000..0501d22d1ec --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Get_WithPrivateEndpoints.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_access_get_with_private_endpoints.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_accesses.get( + resource_group_name="myResourceGroup", + disk_access_name="myDiskAccess", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_Get_WithPrivateEndpoints.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_ListByResourceGroup.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_ListByResourceGroup.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_ListByResourceGroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_ListByResourceGroup.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_ListByResourceGroup.py new file mode 100644 index 00000000000..af6228126ec --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_ListByResourceGroup.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_access_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_accesses.list_by_resource_group( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_ListBySubscription.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_ListBySubscription.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_ListBySubscription.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_ListBySubscription.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_ListBySubscription.py new file mode 100644 index 00000000000..c15e82a93bc --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_ListBySubscription.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_access_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_accesses.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Update.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Update.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Update.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Update.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Update.py new file mode 100644 index 00000000000..2456a26c927 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskAccessExamples/DiskAccess_Update.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_access_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_accesses.begin_update( + resource_group_name="myResourceGroup", + disk_access_name="myDiskAccess", + disk_access={"tags": {"department": "Development", "project": "PrivateEndpoints"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskAccessExamples/DiskAccess_Update.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create.py new file mode 100644 index 00000000000..53412d70a1a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create.py @@ -0,0 +1,47 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_encryption_set_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_encryption_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_encryption_set_name="myDiskEncryptionSet", + disk_encryption_set={ + "identity": {"type": "SystemAssigned"}, + "location": "West US", + "properties": { + "activeKey": { + "keyUrl": "https://myvmvault.vault-int.azure-int.net/keys/{key}", + "sourceVault": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault" + }, + }, + "encryptionType": "EncryptionAtRestWithCustomerKey", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentSubscription.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentSubscription.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentSubscription.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentSubscription.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentSubscription.py new file mode 100644 index 00000000000..49072935c06 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentSubscription.py @@ -0,0 +1,42 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_encryption_set_create_with_key_vault_from_adifferent_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_encryption_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_encryption_set_name="myDiskEncryptionSet", + disk_encryption_set={ + "identity": {"type": "SystemAssigned"}, + "location": "West US", + "properties": { + "activeKey": {"keyUrl": "https://myvaultdifferentsub.vault-int.azure-int.net/keys/{key}"}, + "encryptionType": "EncryptionAtRestWithCustomerKey", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentSubscription.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentTenant.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentTenant.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentTenant.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentTenant.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentTenant.py new file mode 100644 index 00000000000..b59c700282b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentTenant.py @@ -0,0 +1,48 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_encryption_set_create_with_key_vault_from_adifferent_tenant.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_encryption_sets.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_encryption_set_name="myDiskEncryptionSet", + disk_encryption_set={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}": {} + }, + }, + "location": "West US", + "properties": { + "activeKey": {"keyUrl": "https://myvaultdifferenttenant.vault-int.azure-int.net/keys/{key}"}, + "encryptionType": "EncryptionAtRestWithCustomerKey", + "federatedClientId": "00000000-0000-0000-0000-000000000000", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Create_WithKeyVaultFromADifferentTenant.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Delete.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Delete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Delete.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Delete.py new file mode 100644 index 00000000000..ff5362220c1 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Delete.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_encryption_set_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.disk_encryption_sets.begin_delete( + resource_group_name="myResourceGroup", + disk_encryption_set_name="myDiskEncryptionSet", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Delete.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Get.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Get.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Get.py new file mode 100644 index 00000000000..7180940a2e8 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_encryption_set_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_encryption_sets.get( + resource_group_name="myResourceGroup", + disk_encryption_set_name="myDiskEncryptionSet", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Get_WithAutoKeyRotationError.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Get_WithAutoKeyRotationError.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Get_WithAutoKeyRotationError.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Get_WithAutoKeyRotationError.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Get_WithAutoKeyRotationError.py new file mode 100644 index 00000000000..18c9cb87b67 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Get_WithAutoKeyRotationError.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_encryption_set_get_with_auto_key_rotation_error.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_encryption_sets.get( + resource_group_name="myResourceGroup", + disk_encryption_set_name="myDiskEncryptionSet", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Get_WithAutoKeyRotationError.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListAssociatedResources.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListAssociatedResources.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListAssociatedResources.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListAssociatedResources.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListAssociatedResources.py new file mode 100644 index 00000000000..02e6efbf512 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListAssociatedResources.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_encryption_set_list_associated_resources.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_encryption_sets.list_associated_resources( + resource_group_name="myResourceGroup", + disk_encryption_set_name="myDiskEncryptionSet", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListAssociatedResources.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListByResourceGroup.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListByResourceGroup.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListByResourceGroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListByResourceGroup.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListByResourceGroup.py new file mode 100644 index 00000000000..9d82be5a2ed --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListByResourceGroup.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_encryption_set_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_encryption_sets.list_by_resource_group( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListBySubscription.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListBySubscription.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListBySubscription.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListBySubscription.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListBySubscription.py new file mode 100644 index 00000000000..5ec14736950 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_ListBySubscription.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_encryption_set_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_encryption_sets.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update.py new file mode 100644 index 00000000000..c2538e50cac --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update.py @@ -0,0 +1,46 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_encryption_set_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_encryption_sets.begin_update( + resource_group_name="myResourceGroup", + disk_encryption_set_name="myDiskEncryptionSet", + disk_encryption_set={ + "properties": { + "activeKey": { + "keyUrl": "https://myvmvault.vault-int.azure-int.net/keys/keyName/keyVersion", + "sourceVault": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.KeyVault/vaults/myVMVault" + }, + }, + "encryptionType": "EncryptionAtRestWithCustomerKey", + }, + "tags": {"department": "Development", "project": "Encryption"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabled.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabled.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabled.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabled.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabled.py new file mode 100644 index 00000000000..228135d0a23 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabled.py @@ -0,0 +1,42 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_encryption_set_update_with_rotation_to_latest_key_version_enabled.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_encryption_sets.begin_update( + resource_group_name="myResourceGroup", + disk_encryption_set_name="myDiskEncryptionSet", + disk_encryption_set={ + "identity": {"type": "SystemAssigned"}, + "properties": { + "activeKey": {"keyUrl": "https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1"}, + "encryptionType": "EncryptionAtRestWithCustomerKey", + "rotationToLatestKeyVersionEnabled": True, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabled.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabledInProgress.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabledInProgress.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabledInProgress.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabledInProgress.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabledInProgress.py new file mode 100644 index 00000000000..0c41c765981 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabledInProgress.py @@ -0,0 +1,42 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_encryption_set_update_with_rotation_to_latest_key_version_enabled_in_progress.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_encryption_sets.begin_update( + resource_group_name="myResourceGroup", + disk_encryption_set_name="myDiskEncryptionSet", + disk_encryption_set={ + "identity": {"type": "SystemAssigned"}, + "properties": { + "activeKey": {"keyUrl": "https://myvaultdifferentsub.vault-int.azure-int.net/keys/keyName/keyVersion1"}, + "encryptionType": "EncryptionAtRestWithCustomerKey", + "rotationToLatestKeyVersionEnabled": True, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskEncryptionSetExamples/DiskEncryptionSet_Update_WithRotationToLatestKeyVersionEnabledInProgress.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess.py new file mode 100644 index 00000000000..f85104c5189 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_begin_get_access.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_grant_access( + resource_group_name="myResourceGroup", + disk_name="myDisk", + grant_access_data={"access": "Read", "durationInSeconds": 300, "fileFormat": "VHD"}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_BeginGetAccess.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess_WithVMGuestState.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess_WithVMGuestState.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess_WithVMGuestState.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess_WithVMGuestState.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess_WithVMGuestState.py new file mode 100644 index 00000000000..c74d9de1d03 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess_WithVMGuestState.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_begin_get_access_with_vm_guest_state.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_grant_access( + resource_group_name="myResourceGroup", + disk_name="myDisk", + grant_access_data={"access": "Read", "durationInSeconds": 300, "getSecureVMGuestStateSAS": True}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_BeginGetAccess_WithVMGuestState.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess_WithVMGuestStateAndVMMetadata.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess_WithVMGuestStateAndVMMetadata.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess_WithVMGuestStateAndVMMetadata.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess_WithVMGuestStateAndVMMetadata.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess_WithVMGuestStateAndVMMetadata.py new file mode 100644 index 00000000000..f393f59f407 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_BeginGetAccess_WithVMGuestStateAndVMMetadata.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_begin_get_access_with_vm_guest_state_and_vm_metadata.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_grant_access( + resource_group_name="myResourceGroup", + disk_name="myDisk", + grant_access_data={"access": "Read", "durationInSeconds": 300, "getSecureVMGuestStateSAS": True}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_BeginGetAccess_WithVMGuestStateAndVMMetadata.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_CreateOrUpdate_AvailabilityPolicy.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_CreateOrUpdate_AvailabilityPolicy.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_CreateOrUpdate_AvailabilityPolicy.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_CreateOrUpdate_AvailabilityPolicy.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_CreateOrUpdate_AvailabilityPolicy.py new file mode 100644 index 00000000000..4eeb2241cfc --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_CreateOrUpdate_AvailabilityPolicy.py @@ -0,0 +1,42 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_or_update_availability_policy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": { + "availabilityPolicy": {"actionOnDiskDelay": "AutomaticReattach"}, + "creationData": {"createOption": "Empty"}, + "diskSizeGB": 1024, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_CreateOrUpdate_AvailabilityPolicy.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.py new file mode 100644 index 00000000000..92ab890583d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_or_update_bursting_enabled.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={"properties": {"burstingEnabled": True, "diskSizeGB": 1024}}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_CreateOrUpdate_BurstingEnabled.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByCopyingASnapshot.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByCopyingASnapshot.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByCopyingASnapshot.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByCopyingASnapshot.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByCopyingASnapshot.py new file mode 100644 index 00000000000..1df86d9896e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByCopyingASnapshot.py @@ -0,0 +1,43 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_by_copying_asnapshot.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "Copy", + "sourceResourceId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot", + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_ByCopyingASnapshot.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.py new file mode 100644 index 00000000000..0069f208f87 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.py @@ -0,0 +1,44 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_by_importing_blob_from_adifferent_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "Import", + "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + "storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_ByImportingBlobFromADifferentSubscription.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.py new file mode 100644 index 00000000000..f274eae2f36 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.py @@ -0,0 +1,43 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_by_importing_blob_from_the_same_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "Import", + "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_ByImportingBlobFromTheSameSubscription.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.py new file mode 100644 index 00000000000..d4ccaa798e9 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.py @@ -0,0 +1,50 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_confidential_vm_supported_disk_encrypted_with_cmk.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "FromImage", + "imageReference": { + "id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0" + }, + }, + "osType": "Windows", + "securityProfile": { + "secureVMDiskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}", + "securityType": "ConfidentialVM_DiskEncryptedWithCustomerKey", + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_ConfidentialVMSupportedDiskEncryptedWithCMK.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_Empty.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_Empty.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_Empty.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_Empty.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_Empty.py new file mode 100644 index 00000000000..50baeb1b5c7 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_Empty.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_empty.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={"location": "West US", "properties": {"creationData": {"createOption": "Empty"}, "diskSizeGB": 200}}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_Empty.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAPlatformImage.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAPlatformImage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAPlatformImage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAPlatformImage.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAPlatformImage.py new file mode 100644 index 00000000000..b264dfa839e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAPlatformImage.py @@ -0,0 +1,46 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_from_aplatform_image.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "FromImage", + "imageReference": { + "id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/westus/Publishers/{publisher}/ArtifactTypes/VMImage/Offers/{offer}/Skus/{sku}/Versions/1.0.0" + }, + }, + "osType": "Windows", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAPlatformImage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.py new file mode 100644 index 00000000000..a78ad0852c7 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.py @@ -0,0 +1,46 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_from_an_azure_compute_gallery_community_image.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "FromImage", + "galleryImageReference": { + "communityGalleryImageId": "/CommunityGalleries/{communityGalleryPublicGalleryName}/Images/{imageName}/Versions/1.0.0" + }, + }, + "osType": "Windows", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryCommunityImage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.py new file mode 100644 index 00000000000..4cef0f4e5eb --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.py @@ -0,0 +1,46 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_from_an_azure_compute_gallery_direct_shared_image.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "FromImage", + "galleryImageReference": { + "sharedGalleryImageId": "/SharedGalleries/{sharedGalleryUniqueName}/Images/{imageName}/Versions/1.0.0" + }, + }, + "osType": "Windows", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryDirectSharedImage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.py new file mode 100644 index 00000000000..512dc9bf627 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.py @@ -0,0 +1,46 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_from_an_azure_compute_gallery_image.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscriptionId}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "FromImage", + "galleryImageReference": { + "id": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Providers/Microsoft.Compute/Galleries/{galleryName}/Images/{imageName}/Versions/1.0.0" + }, + }, + "osType": "Windows", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAnAzureComputeGalleryImage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnElasticSanVolumeSnapshot.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnElasticSanVolumeSnapshot.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnElasticSanVolumeSnapshot.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnElasticSanVolumeSnapshot.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnElasticSanVolumeSnapshot.py new file mode 100644 index 00000000000..a0b6ee0ff5e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnElasticSanVolumeSnapshot.py @@ -0,0 +1,43 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_from_an_elastic_san_volume_snapshot.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "CopyFromSanSnapshot", + "elasticSanResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot", + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAnElasticSanVolumeSnapshot.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnExistingManagedDisk.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnExistingManagedDisk.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnExistingManagedDisk.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnExistingManagedDisk.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnExistingManagedDisk.py new file mode 100644 index 00000000000..86b8441de60 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromAnExistingManagedDisk.py @@ -0,0 +1,43 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_from_an_existing_managed_disk.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk2", + disk={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "Copy", + "sourceResourceId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1", + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromAnExistingManagedDisk.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromImportSecure.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromImportSecure.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromImportSecure.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromImportSecure.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromImportSecure.py new file mode 100644 index 00000000000..b8255bcdbb4 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromImportSecure.py @@ -0,0 +1,47 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_from_import_secure.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "ImportSecure", + "securityDataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd", + "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + "storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", + }, + "osType": "Windows", + "securityProfile": {"securityType": "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey"}, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromImportSecure.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromImportSecure_WithVMMetadata.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromImportSecure_WithVMMetadata.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromImportSecure_WithVMMetadata.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromImportSecure_WithVMMetadata.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromImportSecure_WithVMMetadata.py new file mode 100644 index 00000000000..a1d88fc7151 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromImportSecure_WithVMMetadata.py @@ -0,0 +1,48 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_from_import_secure_with_vm_metadata.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "ImportSecure", + "securityDataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmgs.vhd", + "securityMetadataUri": "https://mystorageaccount.blob.core.windows.net/osimages/vmmd.vhd", + "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + "storageAccountId": "subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", + }, + "osType": "Windows", + "securityProfile": {"securityType": "ConfidentialVM_VMGuestStateOnlyEncryptedWithPlatformKey"}, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromImportSecure_WithVMMetadata.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromUploadPreparedSecure.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromUploadPreparedSecure.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromUploadPreparedSecure.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromUploadPreparedSecure.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromUploadPreparedSecure.py new file mode 100644 index 00000000000..243bd0cf99f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_FromUploadPreparedSecure.py @@ -0,0 +1,42 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_from_upload_prepared_secure.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": { + "creationData": {"createOption": "UploadPreparedSecure", "uploadSizeBytes": 10737418752}, + "osType": "Windows", + "securityProfile": {"securityType": "TrustedLaunch"}, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_FromUploadPreparedSecure.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_InExtendedLocation.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_InExtendedLocation.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_InExtendedLocation.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_InExtendedLocation.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_InExtendedLocation.py new file mode 100644 index 00000000000..97b6cd155a1 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_InExtendedLocation.py @@ -0,0 +1,39 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_in_extended_location.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "extendedLocation": {"name": "{edge-zone-id}", "type": "EdgeZone"}, + "location": "West US", + "properties": {"creationData": {"createOption": "Empty"}, "diskSizeGB": 200}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_InExtendedLocation.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_PerformancePlus.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_PerformancePlus.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_PerformancePlus.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_PerformancePlus.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_PerformancePlus.py new file mode 100644 index 00000000000..ddadb491af5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_PerformancePlus.py @@ -0,0 +1,38 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_performance_plus.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": {"creationData": {"createOption": "Upload", "performancePlus": True}}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_PerformancePlus.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_UploadDisk.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_UploadDisk.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_UploadDisk.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_UploadDisk.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_UploadDisk.py new file mode 100644 index 00000000000..42fdc984d91 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_UploadDisk.py @@ -0,0 +1,38 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_upload_disk.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": {"creationData": {"createOption": "Upload", "uploadSizeBytes": 10737418752}}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_UploadDisk.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDataAccessAuthMode.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDataAccessAuthMode.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDataAccessAuthMode.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDataAccessAuthMode.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDataAccessAuthMode.py new file mode 100644 index 00000000000..5fff2ebe531 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDataAccessAuthMode.py @@ -0,0 +1,42 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_with_data_access_auth_mode.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": { + "creationData": {"createOption": "Empty"}, + "dataAccessAuthMode": "AzureActiveDirectory", + "diskSizeGB": 200, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithDataAccessAuthMode.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDiskAccess.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDiskAccess.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDiskAccess.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDiskAccess.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDiskAccess.py new file mode 100644 index 00000000000..078a35071d3 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDiskAccess.py @@ -0,0 +1,43 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_with_disk_access.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": { + "creationData": {"createOption": "Empty"}, + "diskAccessId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskAccesses/{existing-diskAccess-name}", + "diskSizeGB": 200, + "networkAccessPolicy": "AllowPrivate", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithDiskAccess.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDiskEncryptionSet.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDiskEncryptionSet.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDiskEncryptionSet.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDiskEncryptionSet.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDiskEncryptionSet.py new file mode 100644 index 00000000000..c06701c1b5e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithDiskEncryptionSet.py @@ -0,0 +1,44 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_with_disk_encryption_set.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": { + "creationData": {"createOption": "Empty"}, + "diskSizeGB": 200, + "encryption": { + "diskEncryptionSetId": "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSets/{existing-diskEncryptionSet-name}" + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithDiskEncryptionSet.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithLogicalSectorSize.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithLogicalSectorSize.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithLogicalSectorSize.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithLogicalSectorSize.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithLogicalSectorSize.py new file mode 100644 index 00000000000..dd0a44a678a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithLogicalSectorSize.py @@ -0,0 +1,39 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_with_logical_sector_size.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": {"creationData": {"createOption": "Empty", "logicalSectorSize": 512}, "diskSizeGB": 200}, + "sku": {"name": "UltraSSD_LRS"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithLogicalSectorSize.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.py new file mode 100644 index 00000000000..af00aa3b9d4 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.py @@ -0,0 +1,42 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_with_optimized_for_frequent_attach.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": { + "creationData": {"createOption": "Empty"}, + "diskSizeGB": 200, + "optimizedForFrequentAttach": True, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithOptimizedForFrequentAttach.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.py new file mode 100644 index 00000000000..a84b2c1aac6 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.py @@ -0,0 +1,44 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_with_premium_v2_lrsaccount_type.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myPremiumV2Disk", + disk={ + "location": "West US", + "properties": { + "creationData": {"createOption": "Empty"}, + "diskIOPSReadWrite": 125, + "diskMBpsReadWrite": 3000, + "diskSizeGB": 200, + }, + "sku": {"name": "PremiumV2_LRS"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithPremiumV2_LRSAccountType.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithSSDZRSAccountType.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithSSDZRSAccountType.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithSSDZRSAccountType.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithSSDZRSAccountType.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithSSDZRSAccountType.py new file mode 100644 index 00000000000..5300082cb94 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithSSDZRSAccountType.py @@ -0,0 +1,39 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_with_ssdzrs_account_type.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "West US", + "properties": {"creationData": {"createOption": "Empty"}, "diskSizeGB": 200}, + "sku": {"name": "Premium_ZRS"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithSSDZRSAccountType.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithSecurityProfile.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithSecurityProfile.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithSecurityProfile.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithSecurityProfile.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithSecurityProfile.py new file mode 100644 index 00000000000..444b989be81 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithSecurityProfile.py @@ -0,0 +1,47 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_with_security_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "location": "North Central US", + "properties": { + "creationData": { + "createOption": "FromImage", + "imageReference": { + "id": "/Subscriptions/{subscriptionId}/Providers/Microsoft.Compute/Locations/uswest/Publishers/Microsoft/ArtifactTypes/VMImage/Offers/{offer}" + }, + }, + "osType": "Windows", + "securityProfile": {"securityType": "TrustedLaunch"}, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithSecurityProfile.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.py new file mode 100644 index 00000000000..b713ba6c269 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.py @@ -0,0 +1,45 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_create_with_ultra_ssd_read_only.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_create_or_update( + resource_group_name="myResourceGroup", + disk_name="myUltraReadOnlyDisk", + disk={ + "location": "West US", + "properties": { + "creationData": {"createOption": "Empty", "logicalSectorSize": 4096}, + "diskIOPSReadWrite": 125, + "diskMBpsReadWrite": 3000, + "diskSizeGB": 200, + "encryption": {"type": "EncryptionAtRestWithPlatformKey"}, + }, + "sku": {"name": "UltraSSD_LRS"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Create_WithUltraSSD_ReadOnly.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Delete.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Delete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Delete.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Delete.py new file mode 100644 index 00000000000..9363f7b311b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Delete.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.disks.begin_delete( + resource_group_name="myResourceGroup", + disk_name="myDisk", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Delete.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_EndGetAccess.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_EndGetAccess.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_EndGetAccess.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_EndGetAccess.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_EndGetAccess.py new file mode 100644 index 00000000000..7a22bb0f50d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_EndGetAccess.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_end_get_access.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.disks.begin_revoke_access( + resource_group_name="myResourceGroup", + disk_name="myDisk", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_EndGetAccess.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Get.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Get.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Get.py new file mode 100644 index 00000000000..9308ef71f3d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.get( + resource_group_name="myResourceGroup", + disk_name="myManagedDisk", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_ListByResourceGroup.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_ListByResourceGroup.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_ListByResourceGroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_ListByResourceGroup.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_ListByResourceGroup.py new file mode 100644 index 00000000000..eaa81608b2d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_ListByResourceGroup.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.list_by_resource_group( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_ListBySubscription.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_ListBySubscription.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_ListBySubscription.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_ListBySubscription.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_ListBySubscription.py new file mode 100644 index 00000000000..eff736aeb0b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_ListBySubscription.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddAcceleratedNetworking.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddAcceleratedNetworking.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddAcceleratedNetworking.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddAcceleratedNetworking.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddAcceleratedNetworking.py new file mode 100644 index 00000000000..524806fdc4f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddAcceleratedNetworking.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_update_add_accelerated_networking.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={"properties": {"supportedCapabilities": {"acceleratedNetwork": False}}}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_AddAcceleratedNetworking.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddDiskControllerTypes.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddDiskControllerTypes.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddDiskControllerTypes.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddDiskControllerTypes.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddDiskControllerTypes.py new file mode 100644 index 00000000000..77b9ab7a55d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddDiskControllerTypes.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_update_add_disk_controller_types.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={"properties": {"supportedCapabilities": {"diskControllerTypes": "SCSI"}}}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_AddDiskControllerTypes.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddPurchasePlan.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddPurchasePlan.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddPurchasePlan.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddPurchasePlan.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddPurchasePlan.py new file mode 100644 index 00000000000..9cd790b0fb1 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddPurchasePlan.py @@ -0,0 +1,44 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_update_add_purchase_plan.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={ + "properties": { + "purchasePlan": { + "name": "myPurchasePlanName", + "product": "myPurchasePlanProduct", + "promotionCode": "myPurchasePlanPromotionCode", + "publisher": "myPurchasePlanPublisher", + } + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_AddPurchasePlan.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddSupportsHibernation.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddSupportsHibernation.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddSupportsHibernation.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddSupportsHibernation.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddSupportsHibernation.py new file mode 100644 index 00000000000..e10294b3ef1 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_AddSupportsHibernation.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_update_add_supports_hibernation.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={"properties": {"supportsHibernation": True}}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_AddSupportsHibernation.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_ChangeTier.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_ChangeTier.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_ChangeTier.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_ChangeTier.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_ChangeTier.py new file mode 100644 index 00000000000..cc124c397c4 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_ChangeTier.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_update_change_tier.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={"properties": {"tier": "P30"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_ChangeTier.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_DisableBursting.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_DisableBursting.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_DisableBursting.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_DisableBursting.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_DisableBursting.py new file mode 100644 index 00000000000..770e04f5617 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_DisableBursting.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_update_disable_bursting.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={"properties": {"burstingEnabled": False}}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_DisableBursting.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.py new file mode 100644 index 00000000000..36a57078cac --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_update_disable_optimized_for_frequent_attach.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={"properties": {"optimizedForFrequentAttach": False}}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_DisableOptimizedForFrequentAttach.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_RemoveDiskAccess.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_RemoveDiskAccess.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_RemoveDiskAccess.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_RemoveDiskAccess.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_RemoveDiskAccess.py new file mode 100644 index 00000000000..59e4ad347bb --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_RemoveDiskAccess.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_update_remove_disk_access.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={"properties": {"networkAccessPolicy": "AllowAll"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_RemoveDiskAccess.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_ToAddArchitecture.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_ToAddArchitecture.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_ToAddArchitecture.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_ToAddArchitecture.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_ToAddArchitecture.py new file mode 100644 index 00000000000..7d7b40f535d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskExamples/Disk_Update_ToAddArchitecture.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_update_to_add_architecture.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disks.begin_update( + resource_group_name="myResourceGroup", + disk_name="myDisk", + disk={"properties": {"supportedCapabilities": {"architecture": "Arm64"}}}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskExamples/Disk_Update_ToAddArchitecture.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_BeginGetAccess.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_BeginGetAccess.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_BeginGetAccess.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_BeginGetAccess.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_BeginGetAccess.py new file mode 100644 index 00000000000..20682981c3d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_BeginGetAccess.py @@ -0,0 +1,37 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_restore_point_begin_get_access.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_restore_point.begin_grant_access( + resource_group_name="myResourceGroup", + restore_point_collection_name="rpc", + vm_restore_point_name="vmrp", + disk_restore_point_name="TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + grant_access_data={"access": "Read", "durationInSeconds": 300, "fileFormat": "VHDX"}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskRestorePointExamples/DiskRestorePoint_BeginGetAccess.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_EndGetAccess.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_EndGetAccess.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_EndGetAccess.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_EndGetAccess.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_EndGetAccess.py new file mode 100644 index 00000000000..407d18ad792 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_EndGetAccess.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_restore_point_end_get_access.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.disk_restore_point.begin_revoke_access( + resource_group_name="myResourceGroup", + restore_point_collection_name="rpc", + vm_restore_point_name="vmrp", + disk_restore_point_name="TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskRestorePointExamples/DiskRestorePoint_EndGetAccess.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_Get.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_Get.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_Get.py new file mode 100644 index 00000000000..aa56ab31b34 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_Get.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_restore_point_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_restore_point.get( + resource_group_name="myResourceGroup", + restore_point_collection_name="rpc", + vm_restore_point_name="vmrp", + disk_restore_point_name="TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskRestorePointExamples/DiskRestorePoint_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_Get_WhenSourceResourceIsFromDifferentRegion.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_Get_WhenSourceResourceIsFromDifferentRegion.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_Get_WhenSourceResourceIsFromDifferentRegion.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_Get_WhenSourceResourceIsFromDifferentRegion.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_Get_WhenSourceResourceIsFromDifferentRegion.py new file mode 100644 index 00000000000..1c691b9f4c5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_Get_WhenSourceResourceIsFromDifferentRegion.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_restore_point_get_when_source_resource_is_from_different_region.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_restore_point.get( + resource_group_name="myResourceGroup", + restore_point_collection_name="rpc", + vm_restore_point_name="vmrp", + disk_restore_point_name="TestDisk45ceb03433006d1baee0_b70cd924-3362-4a80-93c2-9415eaa12745", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskRestorePointExamples/DiskRestorePoint_Get_WhenSourceResourceIsFromDifferentRegion.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_ListByVmRestorePoint.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_ListByVmRestorePoint.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_ListByVmRestorePoint.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_ListByVmRestorePoint.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_ListByVmRestorePoint.py new file mode 100644 index 00000000000..66ff406d3b4 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/diskRestorePointExamples/DiskRestorePoint_ListByVmRestorePoint.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python disk_restore_point_list_by_vm_restore_point.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.disk_restore_point.list_by_restore_point( + resource_group_name="myResourceGroup", + restore_point_collection_name="rpc", + vm_restore_point_name="vmrp", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/diskRestorePointExamples/DiskRestorePoint_ListByVmRestorePoint.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_BeginGetAccess.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_BeginGetAccess.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_BeginGetAccess.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_BeginGetAccess.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_BeginGetAccess.py new file mode 100644 index 00000000000..5372dcdc084 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_BeginGetAccess.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python snapshot_begin_get_access.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.snapshots.begin_grant_access( + resource_group_name="myResourceGroup", + snapshot_name="mySnapshot", + grant_access_data={"access": "Read", "durationInSeconds": 300, "fileFormat": "VHDX"}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_BeginGetAccess.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.py new file mode 100644 index 00000000000..f6532ee0531 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.py @@ -0,0 +1,44 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python snapshot_create_by_importing_an_unmanaged_blob_from_adifferent_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.snapshots.begin_create_or_update( + resource_group_name="myResourceGroup", + snapshot_name="mySnapshot1", + snapshot={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "Import", + "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + "storageAccountId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount", + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromADifferentSubscription.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.py new file mode 100644 index 00000000000..cf707799f71 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.py @@ -0,0 +1,43 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python snapshot_create_by_importing_an_unmanaged_blob_from_the_same_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.snapshots.begin_create_or_update( + resource_group_name="myResourceGroup", + snapshot_name="mySnapshot1", + snapshot={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "Import", + "sourceUri": "https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd", + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Create_ByImportingAnUnmanagedBlobFromTheSameSubscription.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_EnhancedProvisionedBandwidthCopySpeed.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_EnhancedProvisionedBandwidthCopySpeed.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_EnhancedProvisionedBandwidthCopySpeed.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_EnhancedProvisionedBandwidthCopySpeed.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_EnhancedProvisionedBandwidthCopySpeed.py new file mode 100644 index 00000000000..82472b5d509 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_EnhancedProvisionedBandwidthCopySpeed.py @@ -0,0 +1,44 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python snapshot_create_enhanced_provisioned_bandwidth_copy_speed.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.snapshots.begin_create_or_update( + resource_group_name="myResourceGroup", + snapshot_name="mySnapshot2", + snapshot={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "CopyStart", + "provisionedBandwidthCopySpeed": "Enhanced", + "sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1", + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Create_EnhancedProvisionedBandwidthCopySpeed.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnElasticSanVolumeSnapshot.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnElasticSanVolumeSnapshot.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnElasticSanVolumeSnapshot.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnElasticSanVolumeSnapshot.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnElasticSanVolumeSnapshot.py new file mode 100644 index 00000000000..12e4c9eb219 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnElasticSanVolumeSnapshot.py @@ -0,0 +1,43 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python snapshot_create_from_an_elastic_san_volume_snapshot.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.snapshots.begin_create_or_update( + resource_group_name="myResourceGroup", + snapshot_name="mySnapshot", + snapshot={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "CopyFromSanSnapshot", + "elasticSanResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ElasticSan/elasticSans/myElasticSan/volumegroups/myElasticSanVolumeGroup/snapshots/myElasticSanVolumeSnapshot", + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Create_FromAnElasticSanVolumeSnapshot.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnExistingSnapshot.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnExistingSnapshot.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnExistingSnapshot.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnExistingSnapshot.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnExistingSnapshot.py new file mode 100644 index 00000000000..b24794c9650 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnExistingSnapshot.py @@ -0,0 +1,43 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python snapshot_create_from_an_existing_snapshot.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.snapshots.begin_create_or_update( + resource_group_name="myResourceGroup", + snapshot_name="mySnapshot2", + snapshot={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "Copy", + "sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1", + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshot.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.py new file mode 100644 index 00000000000..910037f46bf --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.py @@ -0,0 +1,43 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python snapshot_create_from_an_existing_snapshot_in_different_region.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.snapshots.begin_create_or_update( + resource_group_name="myResourceGroup", + snapshot_name="mySnapshot2", + snapshot={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "CopyStart", + "sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1", + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Create_FromAnExistingSnapshotInDifferentRegion.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_InstantAccessSnapshot.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_InstantAccessSnapshot.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_InstantAccessSnapshot.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_InstantAccessSnapshot.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_InstantAccessSnapshot.py new file mode 100644 index 00000000000..a19ab8ec298 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Create_InstantAccessSnapshot.py @@ -0,0 +1,44 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python snapshot_create_instant_access_snapshot.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.snapshots.begin_create_or_update( + resource_group_name="myResourceGroup", + snapshot_name="mySnapshot2", + snapshot={ + "location": "West US", + "properties": { + "creationData": { + "createOption": "Copy", + "instantAccessDurationMinutes": 120, + "sourceResourceId": "subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/myDisk1", + } + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Create_InstantAccessSnapshot.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Delete.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Delete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Delete.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Delete.py new file mode 100644 index 00000000000..877c404896e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Delete.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python snapshot_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.snapshots.begin_delete( + resource_group_name="myResourceGroup", + snapshot_name="mySnapshot", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Delete.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_EndGetAccess.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_EndGetAccess.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_EndGetAccess.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_EndGetAccess.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_EndGetAccess.py new file mode 100644 index 00000000000..c069aeb8d3a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_EndGetAccess.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python snapshot_end_get_access.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.snapshots.begin_revoke_access( + resource_group_name="myResourceGroup", + snapshot_name="mySnapshot", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_EndGetAccess.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Get.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Get.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Get.py new file mode 100644 index 00000000000..28c93eb9dbb --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python snapshot_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.snapshots.get( + resource_group_name="myResourceGroup", + snapshot_name="mySnapshot", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_GetIncrementalSnapshot.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_GetIncrementalSnapshot.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_GetIncrementalSnapshot.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_GetIncrementalSnapshot.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_GetIncrementalSnapshot.py new file mode 100644 index 00000000000..e5c85e787f3 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_GetIncrementalSnapshot.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python snapshot_get_incremental_snapshot.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.snapshots.get( + resource_group_name="myResourceGroup", + snapshot_name="myIncrementalSnapshot", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_GetIncrementalSnapshot.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_ListByResourceGroup.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_ListByResourceGroup.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_ListByResourceGroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_ListByResourceGroup.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_ListByResourceGroup.py new file mode 100644 index 00000000000..74811ce78d8 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_ListByResourceGroup.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python snapshot_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.snapshots.list_by_resource_group( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_ListBySubscription.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_ListBySubscription.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_ListBySubscription.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_ListBySubscription.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_ListBySubscription.py new file mode 100644 index 00000000000..c8b6eeed8d2 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_ListBySubscription.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python snapshot_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.snapshots.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Update.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Update.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Update.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Update.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Update.py new file mode 100644 index 00000000000..8abafd05b3e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Update.py @@ -0,0 +1,38 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python snapshot_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.snapshots.begin_update( + resource_group_name="myResourceGroup", + snapshot_name="mySnapshot", + snapshot={ + "properties": {"diskSizeGB": 20}, + "tags": {"department": "Development", "project": "UpdateSnapshots"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Update.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Update_WithAcceleratedNetwork.json b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Update_WithAcceleratedNetwork.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Update_WithAcceleratedNetwork.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Update_WithAcceleratedNetwork.py b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Update_WithAcceleratedNetwork.py new file mode 100644 index 00000000000..a5883d7e805 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples-python/snapshotExamples/Snapshot_Update_WithAcceleratedNetwork.py @@ -0,0 +1,38 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python snapshot_update_with_accelerated_network.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.snapshots.begin_update( + resource_group_name="myResourceGroup", + snapshot_name="mySnapshot", + snapshot={ + "properties": {"diskSizeGB": 20, "supportedCapabilities": {"acceleratedNetwork": False}}, + "tags": {"department": "Development", "project": "UpdateSnapshots"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/DiskRP/stable/2025-01-02/examples/snapshotExamples/Snapshot_Update_WithAcceleratedNetwork.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImageVersion_Get.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImageVersion_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImageVersion_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImageVersion_Get.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImageVersion_Get.py new file mode 100644 index 00000000000..7fbd32895c9 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImageVersion_Get.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python community_gallery_image_version_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.community_gallery_image_versions.get( + location="myLocation", + public_gallery_name="publicGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="myGalleryImageVersionName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/communityGalleryExamples/CommunityGalleryImageVersion_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImageVersion_List.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImageVersion_List.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImageVersion_List.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImageVersion_List.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImageVersion_List.py new file mode 100644 index 00000000000..2996f29e2b5 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImageVersion_List.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python community_gallery_image_version_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.community_gallery_image_versions.list( + location="myLocation", + public_gallery_name="publicGalleryName", + gallery_image_name="myGalleryImageName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/communityGalleryExamples/CommunityGalleryImageVersion_List.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImage_Get.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImage_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImage_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImage_Get.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImage_Get.py new file mode 100644 index 00000000000..c356d61a19c --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImage_Get.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python community_gallery_image_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.community_gallery_images.get( + location="myLocation", + public_gallery_name="publicGalleryName", + gallery_image_name="myGalleryImageName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/communityGalleryExamples/CommunityGalleryImage_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImage_List.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImage_List.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImage_List.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImage_List.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImage_List.py new file mode 100644 index 00000000000..a0093361a0f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGalleryImage_List.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python community_gallery_image_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.community_gallery_images.list( + location="myLocation", + public_gallery_name="publicGalleryName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/communityGalleryExamples/CommunityGalleryImage_List.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGallery_Get.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGallery_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGallery_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGallery_Get.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGallery_Get.py new file mode 100644 index 00000000000..c603ae8e63a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/communityGalleryExamples/CommunityGallery_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python community_gallery_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.community_galleries.get( + location="myLocation", + public_gallery_name="publicGalleryName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/communityGalleryExamples/CommunityGallery_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/CommunityGallery_Create.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/CommunityGallery_Create.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/CommunityGallery_Create.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/CommunityGallery_Create.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/CommunityGallery_Create.py new file mode 100644 index 00000000000..a8c1fc83a5b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/CommunityGallery_Create.py @@ -0,0 +1,49 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python community_gallery_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.galleries.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery={ + "location": "West US", + "properties": { + "description": "This is the gallery description.", + "sharingProfile": { + "communityGalleryInfo": { + "eula": "eula", + "publicNamePrefix": "PirPublic", + "publisherContact": "pir@microsoft.com", + "publisherUri": "uri", + }, + "permissions": "Community", + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/CommunityGallery_Create.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/CommunityGallery_Get.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/CommunityGallery_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/CommunityGallery_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/CommunityGallery_Get.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/CommunityGallery_Get.py new file mode 100644 index 00000000000..7c0938448c6 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/CommunityGallery_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python community_gallery_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.galleries.get( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/CommunityGallery_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Create.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Create.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Create.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Create.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Create.py new file mode 100644 index 00000000000..28495cb3fd4 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Create.py @@ -0,0 +1,78 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_application_version_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_application_versions.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_application_name="myGalleryApplicationName", + gallery_application_version_name="1.0.0", + gallery_application_version={ + "location": "West US", + "properties": { + "publishingProfile": { + "customActions": [ + { + "description": "This is the custom action description.", + "name": "myCustomAction", + "parameters": [ + { + "defaultValue": "default value of parameter.", + "description": "This is the description of the parameter", + "name": "myCustomActionParameter", + "required": False, + "type": "String", + } + ], + "script": "myCustomActionScript", + } + ], + "endOfLifeDate": "2019-07-01T07:00:00Z", + "manageActions": { + "install": 'powershell -command "Expand-Archive -Path package.zip -DestinationPath C:\\package"', + "remove": "del C:\\package ", + }, + "replicaCount": 1, + "source": { + "mediaLink": "https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}" + }, + "storageAccountType": "Standard_LRS", + "targetRegions": [ + { + "excludeFromLatest": False, + "name": "West US", + "regionalReplicaCount": 1, + "storageAccountType": "Standard_LRS", + } + ], + }, + "safetyProfile": {"allowDeletionOfReplicatedLocations": False}, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplicationVersion_Create.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Delete.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Delete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Delete.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Delete.py new file mode 100644 index 00000000000..a49b049fffc --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Delete.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_application_version_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.gallery_application_versions.begin_delete( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_application_name="myGalleryApplicationName", + gallery_application_version_name="1.0.0", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplicationVersion_Delete.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Get.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Get.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Get.py new file mode 100644 index 00000000000..99a1424f4df --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Get.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_application_version_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_application_versions.get( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_application_name="myGalleryApplicationName", + gallery_application_version_name="1.0.0", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplicationVersion_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Get_WithReplicationStatus.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Get_WithReplicationStatus.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Get_WithReplicationStatus.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Get_WithReplicationStatus.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Get_WithReplicationStatus.py new file mode 100644 index 00000000000..ee2b2c69b8a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Get_WithReplicationStatus.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_application_version_get_with_replication_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_application_versions.get( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_application_name="myGalleryApplicationName", + gallery_application_version_name="1.0.0", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplicationVersion_Get_WithReplicationStatus.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_ListByGalleryApplication.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_ListByGalleryApplication.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_ListByGalleryApplication.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_ListByGalleryApplication.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_ListByGalleryApplication.py new file mode 100644 index 00000000000..036e9d97cba --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_ListByGalleryApplication.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_application_version_list_by_gallery_application.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_application_versions.list_by_gallery_application( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_application_name="myGalleryApplicationName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplicationVersion_ListByGalleryApplication.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Update.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Update.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Update.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Update.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Update.py new file mode 100644 index 00000000000..c01b149018e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplicationVersion_Update.py @@ -0,0 +1,61 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_application_version_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_application_versions.begin_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_application_name="myGalleryApplicationName", + gallery_application_version_name="1.0.0", + gallery_application_version={ + "properties": { + "publishingProfile": { + "endOfLifeDate": "2019-07-01T07:00:00Z", + "manageActions": { + "install": 'powershell -command "Expand-Archive -Path package.zip -DestinationPath C:\\package"', + "remove": "del C:\\package ", + }, + "replicaCount": 1, + "source": { + "mediaLink": "https://mystorageaccount.blob.core.windows.net/mycontainer/package.zip?{sasKey}" + }, + "storageAccountType": "Standard_LRS", + "targetRegions": [ + { + "excludeFromLatest": False, + "name": "West US", + "regionalReplicaCount": 1, + "storageAccountType": "Standard_LRS", + } + ], + }, + "safetyProfile": {"allowDeletionOfReplicatedLocations": False}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplicationVersion_Update.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Create.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Create.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Create.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Create.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Create.py new file mode 100644 index 00000000000..9d7e4469bc9 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Create.py @@ -0,0 +1,61 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_application_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_applications.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_application_name="myGalleryApplicationName", + gallery_application={ + "location": "West US", + "properties": { + "customActions": [ + { + "description": "This is the custom action description.", + "name": "myCustomAction", + "parameters": [ + { + "defaultValue": "default value of parameter.", + "description": "This is the description of the parameter", + "name": "myCustomActionParameter", + "required": False, + "type": "String", + } + ], + "script": "myCustomActionScript", + } + ], + "description": "This is the gallery application description.", + "eula": "This is the gallery application EULA.", + "privacyStatementUri": "myPrivacyStatementUri}", + "releaseNoteUri": "myReleaseNoteUri", + "supportedOSType": "Windows", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplication_Create.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Delete.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Delete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Delete.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Delete.py new file mode 100644 index 00000000000..e05eae90c99 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Delete.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_application_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.gallery_applications.begin_delete( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_application_name="myGalleryApplicationName", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplication_Delete.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Get.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Get.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Get.py new file mode 100644 index 00000000000..0ebda853b3b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Get.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_application_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_applications.get( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_application_name="myGalleryApplicationName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplication_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_ListByGallery.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_ListByGallery.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_ListByGallery.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_ListByGallery.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_ListByGallery.py new file mode 100644 index 00000000000..a24456b53e7 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_ListByGallery.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_application_list_by_gallery.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_applications.list_by_gallery( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplication_ListByGallery.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Update.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Update.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Update.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Update.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Update.py new file mode 100644 index 00000000000..b0bbe5df365 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryApplication_Update.py @@ -0,0 +1,60 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_application_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_applications.begin_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_application_name="myGalleryApplicationName", + gallery_application={ + "properties": { + "customActions": [ + { + "description": "This is the custom action description.", + "name": "myCustomAction", + "parameters": [ + { + "defaultValue": "default value of parameter.", + "description": "This is the description of the parameter", + "name": "myCustomActionParameter", + "required": False, + "type": "String", + } + ], + "script": "myCustomActionScript", + } + ], + "description": "This is the gallery application description.", + "eula": "This is the gallery application EULA.", + "privacyStatementUri": "myPrivacyStatementUri}", + "releaseNoteUri": "myReleaseNoteUri", + "supportedOSType": "Windows", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryApplication_Update.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create.py new file mode 100644 index 00000000000..3980f462c7a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create.py @@ -0,0 +1,92 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + gallery_image_version={ + "location": "West US", + "properties": { + "publishingProfile": { + "targetRegions": [ + { + "encryption": { + "dataDiskImages": [ + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet", + "lun": 0, + }, + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet", + "lun": 1, + }, + ], + "osDiskImage": { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet" + }, + }, + "excludeFromLatest": False, + "name": "West US", + "regionalReplicaCount": 1, + }, + { + "encryption": { + "dataDiskImages": [ + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet", + "lun": 0, + }, + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet", + "lun": 1, + }, + ], + "osDiskImage": { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet" + }, + }, + "excludeFromLatest": False, + "name": "East US", + "regionalReplicaCount": 2, + "storageAccountType": "Standard_ZRS", + }, + ] + }, + "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, + "storageProfile": { + "source": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}" + } + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithAdditionalReplicaSets.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithAdditionalReplicaSets.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithAdditionalReplicaSets.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithAdditionalReplicaSets.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithAdditionalReplicaSets.py new file mode 100644 index 00000000000..152262b6afc --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithAdditionalReplicaSets.py @@ -0,0 +1,95 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_create_with_additional_replica_sets.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + gallery_image_version={ + "location": "West US", + "properties": { + "publishingProfile": { + "targetRegions": [ + { + "additionalReplicaSets": [ + {"regionalReplicaCount": 1, "storageAccountType": "PreviumV2_LRS"} + ], + "encryption": { + "dataDiskImages": [ + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet", + "lun": 0, + }, + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet", + "lun": 1, + }, + ], + "osDiskImage": { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet" + }, + }, + "excludeFromLatest": False, + "name": "West US", + "regionalReplicaCount": 1, + }, + { + "encryption": { + "dataDiskImages": [ + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet", + "lun": 0, + }, + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet", + "lun": 1, + }, + ], + "osDiskImage": { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet" + }, + }, + "excludeFromLatest": False, + "name": "East US", + "regionalReplicaCount": 2, + "storageAccountType": "Standard_ZRS", + }, + ] + }, + "safetyProfile": {"allowDeletionOfReplicatedLocations": False}, + "storageProfile": { + "source": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}" + } + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithAdditionalReplicaSets.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithCommunityImageVersionAsSource.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithCommunityImageVersionAsSource.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithCommunityImageVersionAsSource.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithCommunityImageVersionAsSource.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithCommunityImageVersionAsSource.py new file mode 100644 index 00000000000..e61974711ba --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithCommunityImageVersionAsSource.py @@ -0,0 +1,92 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_create_with_community_image_version_as_source.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + gallery_image_version={ + "location": "West US", + "properties": { + "publishingProfile": { + "targetRegions": [ + { + "encryption": { + "dataDiskImages": [ + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet", + "lun": 0, + }, + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet", + "lun": 1, + }, + ], + "osDiskImage": { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet" + }, + }, + "excludeFromLatest": False, + "name": "West US", + "regionalReplicaCount": 1, + }, + { + "encryption": { + "dataDiskImages": [ + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet", + "lun": 0, + }, + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet", + "lun": 1, + }, + ], + "osDiskImage": { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet" + }, + }, + "excludeFromLatest": False, + "name": "East US", + "regionalReplicaCount": 2, + "storageAccountType": "Standard_ZRS", + }, + ] + }, + "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, + "storageProfile": { + "source": { + "communityGalleryImageId": "/communityGalleries/{communityGalleryName}/images/{communityGalleryImageName}" + } + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithCommunityImageVersionAsSource.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithImageVersionAsSource.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithImageVersionAsSource.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithImageVersionAsSource.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithImageVersionAsSource.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithImageVersionAsSource.py new file mode 100644 index 00000000000..26911fb0686 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithImageVersionAsSource.py @@ -0,0 +1,92 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_create_with_image_version_as_source.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + gallery_image_version={ + "location": "West US", + "properties": { + "publishingProfile": { + "targetRegions": [ + { + "encryption": { + "dataDiskImages": [ + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet", + "lun": 0, + }, + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet", + "lun": 1, + }, + ], + "osDiskImage": { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet" + }, + }, + "excludeFromLatest": False, + "name": "West US", + "regionalReplicaCount": 1, + }, + { + "encryption": { + "dataDiskImages": [ + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet", + "lun": 0, + }, + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet", + "lun": 1, + }, + ], + "osDiskImage": { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet" + }, + }, + "excludeFromLatest": False, + "name": "East US", + "regionalReplicaCount": 2, + "storageAccountType": "Standard_ZRS", + }, + ] + }, + "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, + "storageProfile": { + "source": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionName}" + } + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithImageVersionAsSource.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithShallowReplicationMode.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithShallowReplicationMode.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithShallowReplicationMode.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithShallowReplicationMode.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithShallowReplicationMode.py new file mode 100644 index 00000000000..75d83371afb --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithShallowReplicationMode.py @@ -0,0 +1,51 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_create_with_shallow_replication_mode.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + gallery_image_version={ + "location": "West US", + "properties": { + "publishingProfile": { + "replicationMode": "Shallow", + "targetRegions": [{"excludeFromLatest": False, "name": "West US", "regionalReplicaCount": 1}], + }, + "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, + "storageProfile": { + "source": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}" + } + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithShallowReplicationMode.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.py new file mode 100644 index 00000000000..864a0cacbd1 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.py @@ -0,0 +1,96 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_create_with_snapshots_as_source.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + gallery_image_version={ + "location": "West US", + "properties": { + "publishingProfile": { + "targetRegions": [ + { + "encryption": { + "dataDiskImages": [ + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet", + "lun": 1, + } + ], + "osDiskImage": { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet" + }, + }, + "excludeFromLatest": False, + "name": "West US", + "regionalReplicaCount": 1, + }, + { + "encryption": { + "dataDiskImages": [ + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet", + "lun": 1, + } + ], + "osDiskImage": { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet" + }, + }, + "excludeFromLatest": False, + "name": "East US", + "regionalReplicaCount": 2, + "storageAccountType": "Standard_ZRS", + }, + ] + }, + "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, + "storageProfile": { + "dataDiskImages": [ + { + "hostCaching": "None", + "lun": 1, + "source": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/disks/{dataDiskName}" + }, + } + ], + "osDiskImage": { + "hostCaching": "ReadOnly", + "source": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/snapshots/{osSnapshotName}" + }, + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithSnapshotsAsSource.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithTargetExtendedLocations.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithTargetExtendedLocations.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithTargetExtendedLocations.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithTargetExtendedLocations.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithTargetExtendedLocations.py new file mode 100644 index 00000000000..c66e5f71893 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithTargetExtendedLocations.py @@ -0,0 +1,92 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_create_with_target_extended_locations.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + gallery_image_version={ + "location": "West US", + "properties": { + "publishingProfile": { + "targetRegions": [ + { + "encryption": { + "dataDiskImages": [ + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet", + "lun": 0, + }, + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet", + "lun": 1, + }, + ], + "osDiskImage": { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet" + }, + }, + "excludeFromLatest": False, + "name": "West US", + "regionalReplicaCount": 1, + }, + { + "encryption": { + "dataDiskImages": [ + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet", + "lun": 0, + }, + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet", + "lun": 1, + }, + ], + "osDiskImage": { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet" + }, + }, + "excludeFromLatest": False, + "name": "East US", + "regionalReplicaCount": 2, + "storageAccountType": "Standard_ZRS", + }, + ] + }, + "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, + "storageProfile": { + "source": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}" + } + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithTargetExtendedLocations.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVHD.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVHD.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVHD.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVHD.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVHD.py new file mode 100644 index 00000000000..69932832c8c --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVHD.py @@ -0,0 +1,87 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_create_with_vhd.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + gallery_image_version={ + "location": "West US", + "properties": { + "publishingProfile": { + "targetRegions": [ + { + "encryption": { + "dataDiskImages": [ + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet", + "lun": 1, + } + ], + "osDiskImage": { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet" + }, + }, + "excludeFromLatest": False, + "name": "West US", + "regionalReplicaCount": 1, + }, + { + "excludeFromLatest": False, + "name": "East US", + "regionalReplicaCount": 2, + "storageAccountType": "Standard_ZRS", + }, + ] + }, + "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, + "storageProfile": { + "dataDiskImages": [ + { + "hostCaching": "None", + "lun": 1, + "source": { + "storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}", + "uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd", + }, + } + ], + "osDiskImage": { + "hostCaching": "ReadOnly", + "source": { + "storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}", + "uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd", + }, + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVHD.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVHD_UefiSettings.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVHD_UefiSettings.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVHD_UefiSettings.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVHD_UefiSettings.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVHD_UefiSettings.py new file mode 100644 index 00000000000..dbd86079a0f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVHD_UefiSettings.py @@ -0,0 +1,97 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_create_with_vhd_uefi_settings.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + gallery_image_version={ + "location": "West US", + "properties": { + "publishingProfile": { + "targetRegions": [ + { + "encryption": { + "dataDiskImages": [ + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherDiskEncryptionSet", + "lun": 1, + } + ], + "osDiskImage": { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myDiskEncryptionSet" + }, + }, + "excludeFromLatest": False, + "name": "West US", + "regionalReplicaCount": 1, + }, + { + "excludeFromLatest": False, + "name": "East US", + "regionalReplicaCount": 2, + "storageAccountType": "Standard_ZRS", + }, + ] + }, + "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, + "securityProfile": { + "uefiSettings": { + "additionalSignatures": { + "db": [{"type": "x509", "value": [""]}], + "dbx": [{"type": "x509", "value": [""]}], + "kek": [{"type": "sha256", "value": [""]}], + }, + "signatureTemplateNames": ["MicrosoftUefiCertificateAuthorityTemplate"], + } + }, + "storageProfile": { + "dataDiskImages": [ + { + "hostCaching": "None", + "lun": 1, + "source": { + "storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}", + "uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd", + }, + } + ], + "osDiskImage": { + "hostCaching": "ReadOnly", + "source": { + "storageAccountId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/{storageAccount}", + "uri": "https://gallerysourcencus.blob.core.windows.net/myvhds/Windows-Server-2012-R2-20171216-en.us-128GB.vhd", + }, + }, + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVHD_UefiSettings.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVmAsSource.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVmAsSource.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVmAsSource.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVmAsSource.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVmAsSource.py new file mode 100644 index 00000000000..7da9890f1f8 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Create_WithVmAsSource.py @@ -0,0 +1,92 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_create_with_vm_as_source.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + gallery_image_version={ + "location": "West US", + "properties": { + "publishingProfile": { + "targetRegions": [ + { + "encryption": { + "dataDiskImages": [ + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherWestUSDiskEncryptionSet", + "lun": 0, + }, + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet", + "lun": 1, + }, + ], + "osDiskImage": { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myWestUSDiskEncryptionSet" + }, + }, + "excludeFromLatest": False, + "name": "West US", + "regionalReplicaCount": 2, + }, + { + "encryption": { + "dataDiskImages": [ + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myOtherEastUSDiskEncryptionSet", + "lun": 0, + }, + { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet", + "lun": 1, + }, + ], + "osDiskImage": { + "diskEncryptionSetId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/diskEncryptionSet/myEastUSDiskEncryptionSet" + }, + }, + "excludeFromLatest": False, + "name": "East US", + "regionalReplicaCount": 2, + "storageAccountType": "Standard_ZRS", + }, + ] + }, + "safetyProfile": {"allowDeletionOfReplicatedLocations": False, "blockDeletionBeforeEndOfLife": False}, + "storageProfile": { + "source": { + "virtualMachineId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}" + } + }, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Create_WithVmAsSource.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Delete.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Delete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Delete.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Delete.py new file mode 100644 index 00000000000..876542340cd --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Delete.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.gallery_image_versions.begin_delete( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Delete.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get.py new file mode 100644 index 00000000000..d8af3976efe --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.get( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithReplicationStatus.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithReplicationStatus.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithReplicationStatus.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithReplicationStatus.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithReplicationStatus.py new file mode 100644 index 00000000000..2fb6113c4c2 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithReplicationStatus.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_get_with_replication_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.get( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithReplicationStatus.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithSnapshotsAsSource.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithSnapshotsAsSource.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithSnapshotsAsSource.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithSnapshotsAsSource.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithSnapshotsAsSource.py new file mode 100644 index 00000000000..0452d24ae00 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithSnapshotsAsSource.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_get_with_snapshots_as_source.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.get( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithSnapshotsAsSource.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithValidationProfile.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithValidationProfile.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithValidationProfile.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithValidationProfile.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithValidationProfile.py new file mode 100644 index 00000000000..79aeee45d4f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithValidationProfile.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_get_with_validation_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.get( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithValidationProfile.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithValidationProfileAndReplicationStatus.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithValidationProfileAndReplicationStatus.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithValidationProfileAndReplicationStatus.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithValidationProfileAndReplicationStatus.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithValidationProfileAndReplicationStatus.py new file mode 100644 index 00000000000..17a7ef06b89 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithValidationProfileAndReplicationStatus.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_get_with_validation_profile_and_replication_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.get( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithValidationProfileAndReplicationStatus.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithVhdAsSource.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithVhdAsSource.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithVhdAsSource.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithVhdAsSource.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithVhdAsSource.py new file mode 100644 index 00000000000..25a1bad279b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Get_WithVhdAsSource.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_get_with_vhd_as_source.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.get( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Get_WithVhdAsSource.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_ListByGalleryImage.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_ListByGalleryImage.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_ListByGalleryImage.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_ListByGalleryImage.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_ListByGalleryImage.py new file mode 100644 index 00000000000..462368197f3 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_ListByGalleryImage.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_list_by_gallery_image.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.list_by_gallery_image( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_ListByGalleryImage.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update.py new file mode 100644 index 00000000000..7ed127d144a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update.py @@ -0,0 +1,51 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.begin_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + gallery_image_version={ + "properties": { + "publishingProfile": { + "targetRegions": [ + {"name": "West US", "regionalReplicaCount": 1}, + {"name": "East US", "regionalReplicaCount": 2, "storageAccountType": "Standard_ZRS"}, + ] + }, + "storageProfile": { + "source": { + "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/images/{imageName}" + } + }, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Update.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update_RestoreSoftDeleted.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update_RestoreSoftDeleted.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update_RestoreSoftDeleted.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update_RestoreSoftDeleted.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update_RestoreSoftDeleted.py new file mode 100644 index 00000000000..e87e52e566a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update_RestoreSoftDeleted.py @@ -0,0 +1,37 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_update_restore_soft_deleted.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.begin_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + gallery_image_version={"properties": {"restore": True, "storageProfile": {}}}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Update_RestoreSoftDeleted.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update_WithoutSourceId.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update_WithoutSourceId.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update_WithoutSourceId.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update_WithoutSourceId.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update_WithoutSourceId.py new file mode 100644 index 00000000000..b8988233fcc --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImageVersion_Update_WithoutSourceId.py @@ -0,0 +1,47 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_version_update_without_source_id.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_image_versions.begin_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="1.0.0", + gallery_image_version={ + "properties": { + "publishingProfile": { + "targetRegions": [ + {"name": "West US", "regionalReplicaCount": 1}, + {"name": "East US", "regionalReplicaCount": 2, "storageAccountType": "Standard_ZRS"}, + ] + }, + "storageProfile": {}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImageVersion_Update_WithoutSourceId.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Create.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Create.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Create.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Create.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Create.py new file mode 100644 index 00000000000..cfa5023523c --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Create.py @@ -0,0 +1,44 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_images.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image={ + "location": "West US", + "properties": { + "hyperVGeneration": "V1", + "identifier": {"offer": "myOfferName", "publisher": "myPublisherName", "sku": "mySkuName"}, + "osState": "Generalized", + "osType": "Windows", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImage_Create.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Delete.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Delete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Delete.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Delete.py new file mode 100644 index 00000000000..33fc411af6c --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Delete.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.gallery_images.begin_delete( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImage_Delete.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Get.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Get.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Get.py new file mode 100644 index 00000000000..cf2f6663db2 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Get.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_images.get( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImage_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_ListByGallery.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_ListByGallery.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_ListByGallery.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_ListByGallery.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_ListByGallery.py new file mode 100644 index 00000000000..35c5672ff21 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_ListByGallery.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_list_by_gallery.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_images.list_by_gallery( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImage_ListByGallery.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Update.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Update.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Update.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Update.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Update.py new file mode 100644 index 00000000000..8a49eea5040 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_Update.py @@ -0,0 +1,43 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_images.begin_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image={ + "properties": { + "hyperVGeneration": "V1", + "identifier": {"offer": "myOfferName", "publisher": "myPublisherName", "sku": "mySkuName"}, + "osState": "Generalized", + "osType": "Windows", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImage_Update.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_UpdateFeatures.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_UpdateFeatures.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_UpdateFeatures.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_UpdateFeatures.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_UpdateFeatures.py new file mode 100644 index 00000000000..e6312b556df --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GalleryImage_UpdateFeatures.py @@ -0,0 +1,45 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_image_update_features.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_images.begin_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery_image_name="myGalleryImageName", + gallery_image={ + "properties": { + "allowUpdateImage": True, + "features": [{"name": "SecurityType", "startsAtVersion": "2.0.0", "value": "TrustedLaunch"}], + "hyperVGeneration": "V2", + "identifier": {"offer": "myOfferName", "publisher": "myPublisherName", "sku": "mySkuName"}, + "osState": "Generalized", + "osType": "Windows", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GalleryImage_UpdateFeatures.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GallerySoftDeletedResource_ListByArtifactName.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GallerySoftDeletedResource_ListByArtifactName.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GallerySoftDeletedResource_ListByArtifactName.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GallerySoftDeletedResource_ListByArtifactName.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GallerySoftDeletedResource_ListByArtifactName.py new file mode 100644 index 00000000000..a086ed742bc --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/GallerySoftDeletedResource_ListByArtifactName.py @@ -0,0 +1,37 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_soft_deleted_resource_list_by_artifact_name.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.soft_deleted_resource.list_by_artifact_name( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + artifact_type="images", + artifact_name="myGalleryImageName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/GallerySoftDeletedResource_ListByArtifactName.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_AddToSharingProfile.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_AddToSharingProfile.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_AddToSharingProfile.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_AddToSharingProfile.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_AddToSharingProfile.py new file mode 100644 index 00000000000..117c065b26e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_AddToSharingProfile.py @@ -0,0 +1,44 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_add_to_sharing_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_sharing_profile.begin_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + sharing_update={ + "groups": [ + { + "ids": ["34a4ab42-0d72-47d9-bd1a-aed207386dac", "380fd389-260b-41aa-bad9-0a83108c370b"], + "type": "Subscriptions", + }, + {"ids": ["c24c76aa-8897-4027-9b03-8f7928b54ff6"], "type": "AADTenants"}, + ], + "operationType": "Add", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_AddToSharingProfile.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create.py new file mode 100644 index 00000000000..75f02e5e983 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.galleries.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery={"location": "West US", "properties": {"description": "This is the gallery description."}}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Create.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_SoftDeletionEnabled.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_SoftDeletionEnabled.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_SoftDeletionEnabled.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_SoftDeletionEnabled.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_SoftDeletionEnabled.py new file mode 100644 index 00000000000..9c098354a7b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_SoftDeletionEnabled.py @@ -0,0 +1,41 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_create_soft_deletion_enabled.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.galleries.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery={ + "location": "West US", + "properties": { + "description": "This is the gallery description.", + "softDeletePolicy": {"isSoftDeleteEnabled": True}, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Create_SoftDeletionEnabled.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_WithManagedIdentity.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_WithManagedIdentity.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_WithManagedIdentity.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_WithManagedIdentity.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_WithManagedIdentity.py new file mode 100644 index 00000000000..4628b522663 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_WithManagedIdentity.py @@ -0,0 +1,44 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_create_with_managed_identity.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.galleries.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery={ + "identity": { + "type": "SystemAssigned, UserAssigned", + "userAssignedIdentities": { + "/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity": {} + }, + }, + "location": "West US", + "properties": {"description": "This is the gallery description."}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Create_WithManagedIdentity.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_WithSharingProfile.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_WithSharingProfile.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_WithSharingProfile.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_WithSharingProfile.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_WithSharingProfile.py new file mode 100644 index 00000000000..804ac5138bc --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Create_WithSharingProfile.py @@ -0,0 +1,41 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_create_with_sharing_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.galleries.begin_create_or_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery={ + "location": "West US", + "properties": { + "description": "This is the gallery description.", + "sharingProfile": {"permissions": "Groups"}, + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Create_WithSharingProfile.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Delete.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Delete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Delete.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Delete.py new file mode 100644 index 00000000000..c9ac944e7dc --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Delete.py @@ -0,0 +1,33 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.galleries.begin_delete( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Delete.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_EnableCommunityGallery.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_EnableCommunityGallery.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_EnableCommunityGallery.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_EnableCommunityGallery.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_EnableCommunityGallery.py new file mode 100644 index 00000000000..ae7abb5ca58 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_EnableCommunityGallery.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_enable_community_gallery.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_sharing_profile.begin_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + sharing_update={"operationType": "EnableCommunity"}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_EnableCommunityGallery.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get.py new file mode 100644 index 00000000000..a187c815a8b --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.galleries.get( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithExpandSharingProfileGroups.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithExpandSharingProfileGroups.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithExpandSharingProfileGroups.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithExpandSharingProfileGroups.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithExpandSharingProfileGroups.py new file mode 100644 index 00000000000..5f435e0a3da --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithExpandSharingProfileGroups.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_get_with_expand_sharing_profile_groups.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.galleries.get( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Get_WithExpandSharingProfileGroups.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithManagedIdentity.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithManagedIdentity.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithManagedIdentity.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithManagedIdentity.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithManagedIdentity.py new file mode 100644 index 00000000000..eba73ef7343 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithManagedIdentity.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_get_with_managed_identity.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.galleries.get( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Get_WithManagedIdentity.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithSelectPermissions.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithSelectPermissions.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithSelectPermissions.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithSelectPermissions.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithSelectPermissions.py new file mode 100644 index 00000000000..a4201737c0d --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Get_WithSelectPermissions.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_get_with_select_permissions.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.galleries.get( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Get_WithSelectPermissions.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ListByResourceGroup.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ListByResourceGroup.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ListByResourceGroup.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ListByResourceGroup.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ListByResourceGroup.py new file mode 100644 index 00000000000..3ffb9c56659 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ListByResourceGroup.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_list_by_resource_group.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.galleries.list_by_resource_group( + resource_group_name="myResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_ListByResourceGroup.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ListBySubscription.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ListBySubscription.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ListBySubscription.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ListBySubscription.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ListBySubscription.py new file mode 100644 index 00000000000..a2d0ccbf635 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ListBySubscription.py @@ -0,0 +1,32 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_list_by_subscription.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.galleries.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_ListBySubscription.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ResetSharingProfile.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ResetSharingProfile.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ResetSharingProfile.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ResetSharingProfile.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ResetSharingProfile.py new file mode 100644 index 00000000000..15e8ab063be --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_ResetSharingProfile.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_reset_sharing_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_sharing_profile.begin_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + sharing_update={"operationType": "Reset"}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_ResetSharingProfile.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Update.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Update.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Update.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Update.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Update.py new file mode 100644 index 00000000000..19f25f127ce --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryExamples/Gallery_Update.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.galleries.begin_update( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + gallery={"properties": {"description": "This is the gallery description."}}, + ).result() + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryExamples/Gallery_Update.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Delete.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Delete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Delete.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Delete.py new file mode 100644 index 00000000000..da3ff71d96e --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Delete.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_in_vm_access_control_profile_version_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.gallery_in_vm_access_control_profile_versions.begin_delete( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + in_vm_access_control_profile_name="myInVMAccessControlProfileName", + in_vm_access_control_profile_version_name="1.0.0", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Delete.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Get.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Get.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Get.py new file mode 100644 index 00000000000..8530353a7c4 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Get.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_in_vm_access_control_profile_version_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_in_vm_access_control_profile_versions.get( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + in_vm_access_control_profile_name="myInVMAccessControlProfileName", + in_vm_access_control_profile_version_name="1.0.0", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_ListByGalleryInVMAccessControlProfile.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_ListByGalleryInVMAccessControlProfile.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_ListByGalleryInVMAccessControlProfile.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_ListByGalleryInVMAccessControlProfile.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_ListByGalleryInVMAccessControlProfile.py new file mode 100644 index 00000000000..2239d09c2bd --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_ListByGalleryInVMAccessControlProfile.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_in_vm_access_control_profile_version_list_by_gallery_in_vm_access_control_profile.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_in_vm_access_control_profile_versions.list_by_gallery_in_vm_access_control_profile( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + in_vm_access_control_profile_name="myInVMAccessControlProfileName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfileVersion_ListByGalleryInVMAccessControlProfile.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Delete.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Delete.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Delete.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Delete.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Delete.py new file mode 100644 index 00000000000..2cd7c2711d8 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Delete.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_in_vm_access_control_profile_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + client.gallery_in_vm_access_control_profiles.begin_delete( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + in_vm_access_control_profile_name="myInVMAccessControlProfileName", + ).result() + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Delete.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Get.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Get.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Get.py new file mode 100644 index 00000000000..5372924d1cf --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Get.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_in_vm_access_control_profile_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_in_vm_access_control_profiles.get( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + in_vm_access_control_profile_name="myInVMAccessControlProfileName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_ListByGallery.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_ListByGallery.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_ListByGallery.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_ListByGallery.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_ListByGallery.py new file mode 100644 index 00000000000..dd6903adb5f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_ListByGallery.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python gallery_in_vm_access_control_profile_list_by_gallery.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.gallery_in_vm_access_control_profiles.list_by_gallery( + resource_group_name="myResourceGroup", + gallery_name="myGalleryName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/galleryResourceProfileExamples/GalleryInVMAccessControlProfile_ListByGallery.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImageVersion_Get.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImageVersion_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImageVersion_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImageVersion_Get.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImageVersion_Get.py new file mode 100644 index 00000000000..ca4029e774a --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImageVersion_Get.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python shared_gallery_image_version_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.shared_gallery_image_versions.get( + location="myLocation", + gallery_unique_name="galleryUniqueName", + gallery_image_name="myGalleryImageName", + gallery_image_version_name="myGalleryImageVersionName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/sharedGalleryExamples/SharedGalleryImageVersion_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImageVersions_List.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImageVersions_List.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImageVersions_List.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImageVersions_List.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImageVersions_List.py new file mode 100644 index 00000000000..8b4ed758758 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImageVersions_List.py @@ -0,0 +1,36 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python shared_gallery_image_versions_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.shared_gallery_image_versions.list( + location="myLocation", + gallery_unique_name="galleryUniqueName", + gallery_image_name="myGalleryImageName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/sharedGalleryExamples/SharedGalleryImageVersions_List.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImage_Get.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImage_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImage_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImage_Get.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImage_Get.py new file mode 100644 index 00000000000..7bade5c6038 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImage_Get.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python shared_gallery_image_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.shared_gallery_images.get( + location="myLocation", + gallery_unique_name="galleryUniqueName", + gallery_image_name="myGalleryImageName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/sharedGalleryExamples/SharedGalleryImage_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImages_List.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImages_List.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImages_List.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImages_List.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImages_List.py new file mode 100644 index 00000000000..67e63c58ce4 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGalleryImages_List.py @@ -0,0 +1,35 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python shared_gallery_images_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.shared_gallery_images.list( + location="myLocation", + gallery_unique_name="galleryUniqueName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/sharedGalleryExamples/SharedGalleryImages_List.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGallery_Get.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGallery_Get.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGallery_Get.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGallery_Get.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGallery_Get.py new file mode 100644 index 00000000000..7564ff9814f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGallery_Get.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python shared_gallery_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.shared_galleries.get( + location="myLocation", + gallery_unique_name="galleryUniqueName", + ) + print(response) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/sharedGalleryExamples/SharedGallery_Get.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGallery_List.json b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGallery_List.json new file mode 100644 index 00000000000..c6f987b539f --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGallery_List.json @@ -0,0 +1 @@ +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGallery_List.py b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGallery_List.py new file mode 100644 index 00000000000..a1a009b4772 --- /dev/null +++ b/specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples-python/sharedGalleryExamples/SharedGallery_List.py @@ -0,0 +1,34 @@ +from azure.identity import DefaultAzureCredential + +from azure.mgmt.compute import ComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-compute +# USAGE + python shared_gallery_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="{subscription-id}", + ) + + response = client.shared_galleries.list( + location="myLocation", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/examples/sharedGalleryExamples/SharedGallery_List.json +if __name__ == "__main__": + main() diff --git a/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples-python/skus/ListAvailableResourceSkus.json b/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples-python/skus/ListAvailableResourceSkus.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples-python/skus/ListAvailableResourceSkus.json +++ b/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples-python/skus/ListAvailableResourceSkus.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples-python/skus/ListAvailableResourceSkusForARegion.json b/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples-python/skus/ListAvailableResourceSkusForARegion.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples-python/skus/ListAvailableResourceSkusForARegion.json +++ b/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples-python/skus/ListAvailableResourceSkusForARegion.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file diff --git a/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples-python/skus/ListAvailableResourceSkusWithExtendedLocations.json b/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples-python/skus/ListAvailableResourceSkusWithExtendedLocations.json index d93dad14a93..c6f987b539f 100644 --- a/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples-python/skus/ListAvailableResourceSkusWithExtendedLocations.json +++ b/specification/compute/resource-manager/Microsoft.Compute/Skus/stable/2021-07-01/examples-python/skus/ListAvailableResourceSkusWithExtendedLocations.json @@ -1 +1 @@ -{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_36.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file +{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-compute_37.0.0/sdk/compute/azure-mgmt-compute/README.md"} \ No newline at end of file