Creates a Virtual Instance for SAP solutions (VIS) resource
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/sapVirtualInstances/{sapVirtualInstanceName}?api-version=2023-04-01
URI Parameters
| Name |
In |
Required |
Type |
Description |
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
The name of the resource group. The name is case insensitive.
|
|
sapVirtualInstanceName
|
path |
True
|
string
|
The name of the Virtual Instances for SAP solutions resource
|
|
subscriptionId
|
path |
True
|
string
minLength: 1
|
The ID of the target subscription.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
The API version to use for this operation.
|
Request Body
| Name |
Required |
Type |
Description |
|
location
|
True
|
string
|
The geo-location where the resource lives
|
|
properties.configuration
|
True
|
SAPConfiguration:
|
Defines if the SAP system is being created using Azure Center for SAP solutions (ACSS) or if an existing SAP system is being registered with ACSS
|
|
properties.environment
|
True
|
SAPEnvironmentType
|
Defines the environment type - Production/Non Production.
|
|
properties.sapProduct
|
True
|
SAPProductType
|
Defines the SAP Product type.
|
|
identity
|
|
UserAssignedServiceIdentity
|
A pre-created user assigned identity with appropriate roles assigned. To learn more on identity and roles required, visit the ACSS how-to-guide.
|
|
properties.managedResourceGroupConfiguration
|
|
ManagedRGConfiguration
|
Managed resource group configuration
|
|
tags
|
|
object
|
Resource tags.
|
Responses
| Name |
Type |
Description |
|
200 OK
|
SAPVirtualInstance
|
Describes the Virtual Instance for SAP solutions resource which is created successfully.
|
|
201 Created
|
SAPVirtualInstance
|
Describes the Virtual Instance for SAP solutions resource created.
|
|
Other Status Codes
|
ErrorResponse
|
Error response describing why the operation failed.
|
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
| Name |
Description |
|
user_impersonation
|
impersonate your user account
|
Examples
Create Infrastructure (with OS configuration) with custom resource names for Distributed System
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 1
},
"customResourceNames": {
"namingPatternType": "FullResourceName",
"centralServer": {
"virtualMachines": [
{
"vmName": "ascsvm",
"hostName": "ascshostName",
"networkInterfaces": [
{
"networkInterfaceName": "ascsnic"
}
],
"osDiskName": "ascsosdisk",
"dataDiskNames": {
"default": [
"ascsdisk0"
]
}
}
]
},
"applicationServer": {
"virtualMachines": [
{
"vmName": "appvm0",
"hostName": "apphostName0",
"networkInterfaces": [
{
"networkInterfaceName": "appnic0"
}
],
"osDiskName": "app0osdisk",
"dataDiskNames": {
"default": [
"app0disk0"
]
}
},
{
"vmName": "appvm1",
"hostName": "apphostName1",
"networkInterfaces": [
{
"networkInterfaceName": "appnic1"
}
],
"osDiskName": "app1osdisk",
"dataDiskNames": {
"default": [
"app1disk0"
]
}
}
],
"availabilitySetName": "appAvSet"
},
"databaseServer": {
"virtualMachines": [
{
"vmName": "dbvm",
"hostName": "dbhostName",
"networkInterfaces": [
{
"networkInterfaceName": "dbnic"
}
],
"osDiskName": "dbosdisk",
"dataDiskNames": {
"hanaData": [
"hanadata0",
"hanadata1"
],
"hanaLog": [
"hanalog0",
"hanalog1",
"hanalog2"
],
"usrSap": [
"usrsap0"
],
"hanaShared": [
"hanashared0",
"hanashared1"
]
}
}
]
},
"sharedStorage": {
"sharedStorageAccountName": "storageacc",
"sharedStorageAccountPrivateEndPointName": "peForxNFS"
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.ApplicationServerFullResourceNames;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerFullResourceNames;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseServerFullResourceNames;
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.NetworkInterfaceResourceNames;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SharedStorageResourceNames;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.ThreeTierFullResourceNames;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineResourceNames;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_CustomFullResourceNames_Distributed.json
*/
/**
* Sample code: Create Infrastructure (with OS configuration) with custom resource names for Distributed System.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void createInfrastructureWithOSConfigurationWithCustomResourceNamesForDistributedSystem(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("X00-RG")
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E16ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(1L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(6L))
.withDatabaseServer(new DatabaseConfiguration().withDatabaseType(SapDatabaseType.HANA).withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet")
.withVirtualMachineConfiguration(
new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}").withOsConfiguration(
new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(1L))
.withCustomResourceNames(
new ThreeTierFullResourceNames()
.withCentralServer(new CentralServerFullResourceNames().withVirtualMachines(Arrays.asList(
new VirtualMachineResourceNames().withVmName("ascsvm").withHostname("ascshostName")
.withNetworkInterfaces(Arrays.asList(
new NetworkInterfaceResourceNames().withNetworkInterfaceName("ascsnic")))
.withOsDiskName("ascsosdisk")
.withDataDiskNames(mapOf("default", Arrays.asList("ascsdisk0"))))))
.withApplicationServer(
new ApplicationServerFullResourceNames()
.withVirtualMachines(Arrays.asList(
new VirtualMachineResourceNames().withVmName("appvm0")
.withHostname("apphostName0")
.withNetworkInterfaces(Arrays.asList(new NetworkInterfaceResourceNames()
.withNetworkInterfaceName("appnic0")))
.withOsDiskName("app0osdisk")
.withDataDiskNames(mapOf("default", Arrays.asList("app0disk0"))),
new VirtualMachineResourceNames().withVmName("appvm1")
.withHostname("apphostName1")
.withNetworkInterfaces(Arrays.asList(new NetworkInterfaceResourceNames()
.withNetworkInterfaceName("appnic1")))
.withOsDiskName("app1osdisk")
.withDataDiskNames(mapOf("default", Arrays.asList("app1disk0")))))
.withAvailabilitySetName("appAvSet"))
.withDatabaseServer(new DatabaseServerFullResourceNames().withVirtualMachines(Arrays
.asList(new VirtualMachineResourceNames().withVmName("dbvm").withHostname("dbhostName")
.withNetworkInterfaces(Arrays
.asList(new NetworkInterfaceResourceNames().withNetworkInterfaceName("dbnic")))
.withOsDiskName("dbosdisk")
.withDataDiskNames(mapOf("hanaData", Arrays.asList("hanadata0", "hanadata1"),
"hanaLog", Arrays.asList("hanalog0", "hanalog1", "hanalog2"), "hanaShared",
Arrays.asList("hanashared0", "hanashared1"), "usrSap",
Arrays.asList("usrsap0"))))))
.withSharedStorage(
new SharedStorageResourceNames().withSharedStorageAccountName("storageacc")
.withSharedStorageAccountPrivateEndPointName("peForxNFS"))))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_custom_full_resource_names_distributed.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_Distributed.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_Distributed.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithCustomResourceNamesForDistributedSystem() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](6),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E16ds_v4"),
},
},
CustomResourceNames: &armworkloads.ThreeTierFullResourceNames{
NamingPatternType: to.Ptr(armworkloads.NamingPatternTypeFullResourceName),
ApplicationServer: &armworkloads.ApplicationServerFullResourceNames{
AvailabilitySetName: to.Ptr("appAvSet"),
VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
{
DataDiskNames: map[string][]*string{
"default": {
to.Ptr("app0disk0")},
},
HostName: to.Ptr("apphostName0"),
NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
{
NetworkInterfaceName: to.Ptr("appnic0"),
}},
OSDiskName: to.Ptr("app0osdisk"),
VMName: to.Ptr("appvm0"),
},
{
DataDiskNames: map[string][]*string{
"default": {
to.Ptr("app1disk0")},
},
HostName: to.Ptr("apphostName1"),
NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
{
NetworkInterfaceName: to.Ptr("appnic1"),
}},
OSDiskName: to.Ptr("app1osdisk"),
VMName: to.Ptr("appvm1"),
}},
},
CentralServer: &armworkloads.CentralServerFullResourceNames{
VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
{
DataDiskNames: map[string][]*string{
"default": {
to.Ptr("ascsdisk0")},
},
HostName: to.Ptr("ascshostName"),
NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
{
NetworkInterfaceName: to.Ptr("ascsnic"),
}},
OSDiskName: to.Ptr("ascsosdisk"),
VMName: to.Ptr("ascsvm"),
}},
},
DatabaseServer: &armworkloads.DatabaseServerFullResourceNames{
VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
{
DataDiskNames: map[string][]*string{
"hanaData": {
to.Ptr("hanadata0"),
to.Ptr("hanadata1")},
"hanaLog": {
to.Ptr("hanalog0"),
to.Ptr("hanalog1"),
to.Ptr("hanalog2")},
"hanaShared": {
to.Ptr("hanashared0"),
to.Ptr("hanashared1")},
"usrSap": {
to.Ptr("usrsap0")},
},
HostName: to.Ptr("dbhostName"),
NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
{
NetworkInterfaceName: to.Ptr("dbnic"),
}},
OSDiskName: to.Ptr("dbosdisk"),
VMName: to.Ptr("dbvm"),
}},
},
SharedStorage: &armworkloads.SharedStorageResourceNames{
SharedStorageAccountName: to.Ptr("storageacc"),
SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](6),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E16ds_v4"),
// },
// },
// CustomResourceNames: &armworkloads.ThreeTierFullResourceNames{
// NamingPatternType: to.Ptr(armworkloads.NamingPatternTypeFullResourceName),
// ApplicationServer: &armworkloads.ApplicationServerFullResourceNames{
// AvailabilitySetName: to.Ptr("appAvSet"),
// VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
// {
// DataDiskNames: map[string][]*string{
// "default": []*string{
// to.Ptr("app0disk0")},
// },
// HostName: to.Ptr("apphostName0"),
// NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
// {
// NetworkInterfaceName: to.Ptr("appnic0"),
// }},
// OSDiskName: to.Ptr("app0osdisk"),
// VMName: to.Ptr("appvm0"),
// },
// {
// DataDiskNames: map[string][]*string{
// "default": []*string{
// to.Ptr("app1disk0")},
// },
// HostName: to.Ptr("apphostName1"),
// NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
// {
// NetworkInterfaceName: to.Ptr("appnic1"),
// }},
// OSDiskName: to.Ptr("app1osdisk"),
// VMName: to.Ptr("appvm1"),
// }},
// },
// CentralServer: &armworkloads.CentralServerFullResourceNames{
// VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
// {
// DataDiskNames: map[string][]*string{
// "default": []*string{
// to.Ptr("ascsdisk0")},
// },
// HostName: to.Ptr("ascshostName"),
// NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
// {
// NetworkInterfaceName: to.Ptr("ascsnic"),
// }},
// OSDiskName: to.Ptr("ascsosdisk"),
// VMName: to.Ptr("ascsvm"),
// }},
// },
// DatabaseServer: &armworkloads.DatabaseServerFullResourceNames{
// VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
// {
// DataDiskNames: map[string][]*string{
// "hanaData": []*string{
// to.Ptr("hanadata0"),
// to.Ptr("hanadata1")},
// "hanaLog": []*string{
// to.Ptr("hanalog0"),
// to.Ptr("hanalog1"),
// to.Ptr("hanalog2")},
// "hanaShared": []*string{
// to.Ptr("hanashared0"),
// to.Ptr("hanashared1")},
// "usrSap": []*string{
// to.Ptr("usrsap0")},
// },
// HostName: to.Ptr("dbhostName"),
// NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
// {
// NetworkInterfaceName: to.Ptr("dbnic"),
// }},
// OSDiskName: to.Ptr("dbosdisk"),
// VMName: to.Ptr("dbvm"),
// }},
// },
// SharedStorage: &armworkloads.SharedStorageResourceNames{
// SharedStorageAccountName: to.Ptr("storageacc"),
// SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_Distributed.json
*/
async function createInfrastructureWithOSConfigurationWithCustomResourceNamesForDistributedSystem() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
applicationServer: {
instanceCount: 6,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
centralServer: {
instanceCount: 1,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E16ds_v4",
},
},
customResourceNames: {
applicationServer: {
availabilitySetName: "appAvSet",
virtualMachines: [
{
dataDiskNames: { default: ["app0disk0"] },
hostName: "apphostName0",
networkInterfaces: [{ networkInterfaceName: "appnic0" }],
osDiskName: "app0osdisk",
vmName: "appvm0",
},
{
dataDiskNames: { default: ["app1disk0"] },
hostName: "apphostName1",
networkInterfaces: [{ networkInterfaceName: "appnic1" }],
osDiskName: "app1osdisk",
vmName: "appvm1",
},
],
},
centralServer: {
virtualMachines: [
{
dataDiskNames: { default: ["ascsdisk0"] },
hostName: "ascshostName",
networkInterfaces: [{ networkInterfaceName: "ascsnic" }],
osDiskName: "ascsosdisk",
vmName: "ascsvm",
},
],
},
databaseServer: {
virtualMachines: [
{
dataDiskNames: {
hanaData: ["hanadata0", "hanadata1"],
hanaLog: ["hanalog0", "hanalog1", "hanalog2"],
hanaShared: ["hanashared0", "hanashared1"],
usrSap: ["usrsap0"],
},
hostName: "dbhostName",
networkInterfaces: [{ networkInterfaceName: "dbnic" }],
osDiskName: "dbosdisk",
vmName: "dbvm",
},
],
},
namingPatternType: "FullResourceName",
sharedStorage: {
sharedStorageAccountName: "storageacc",
sharedStorageAccountPrivateEndPointName: "peForxNFS",
},
},
databaseServer: {
databaseType: "HANA",
instanceCount: 1,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
},
environment: "Prod",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_Distributed.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("X00-RG", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E16ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 1L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 6L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 1L)
{
DatabaseType = SapDatabaseType.Hana,
})
{
CustomResourceNames = new ThreeTierFullResourceNames
{
CentralServer = new CentralServerFullResourceNames
{
VirtualMachines = {new VirtualMachineResourceNames
{
VmName = "ascsvm",
HostName = "ascshostName",
NetworkInterfaces = {new NetworkInterfaceResourceNames
{
NetworkInterfaceName = "ascsnic",
}},
OSDiskName = "ascsosdisk",
DataDiskNames =
{
["default"] = new string[]{"ascsdisk0"}
},
}},
},
ApplicationServer = new ApplicationServerFullResourceNames
{
VirtualMachines = {new VirtualMachineResourceNames
{
VmName = "appvm0",
HostName = "apphostName0",
NetworkInterfaces = {new NetworkInterfaceResourceNames
{
NetworkInterfaceName = "appnic0",
}},
OSDiskName = "app0osdisk",
DataDiskNames =
{
["default"] = new string[]{"app0disk0"}
},
}, new VirtualMachineResourceNames
{
VmName = "appvm1",
HostName = "apphostName1",
NetworkInterfaces = {new NetworkInterfaceResourceNames
{
NetworkInterfaceName = "appnic1",
}},
OSDiskName = "app1osdisk",
DataDiskNames =
{
["default"] = new string[]{"app1disk0"}
},
}},
AvailabilitySetName = "appAvSet",
},
DatabaseServer = new DatabaseServerFullResourceNames
{
VirtualMachines = {new VirtualMachineResourceNames
{
VmName = "dbvm",
HostName = "dbhostName",
NetworkInterfaces = {new NetworkInterfaceResourceNames
{
NetworkInterfaceName = "dbnic",
}},
OSDiskName = "dbosdisk",
DataDiskNames =
{
["hanaData"] = new string[]{"hanadata0", "hanadata1"},
["hanaLog"] = new string[]{"hanalog0", "hanalog1", "hanalog2"},
["hanaShared"] = new string[]{"hanashared0", "hanashared1"},
["usrSap"] = new string[]{"usrsap0"}
},
}},
},
SharedStorage = new SharedStorageResourceNames
{
SharedStorageAccountName = "storageacc",
SharedStorageAccountPrivateEndPointName = "peForxNFS",
},
},
},
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
},
"customResourceNames": {
"namingPatternType": "FullResourceName",
"centralServer": {
"virtualMachines": [
{
"vmName": "ascsvm",
"hostName": "ascshostName",
"networkInterfaces": [
{
"networkInterfaceName": "ascsnic"
}
],
"osDiskName": "ascsosdisk",
"dataDiskNames": {
"default": [
"ascsdisk0"
]
}
}
]
},
"applicationServer": {
"virtualMachines": [
{
"vmName": "appvm0",
"hostName": "apphostName0",
"networkInterfaces": [
{
"networkInterfaceName": "appnic0"
}
],
"osDiskName": "app0osdisk",
"dataDiskNames": {
"default": [
"app0disk0"
]
}
},
{
"vmName": "appvm1",
"hostName": "apphostName1",
"networkInterfaces": [
{
"networkInterfaceName": "appnic1"
}
],
"osDiskName": "app1osdisk",
"dataDiskNames": {
"default": [
"app1disk0"
]
}
}
],
"availabilitySetName": "appAvSet"
},
"databaseServer": {
"virtualMachines": [
{
"vmName": "dbvm",
"hostName": "dbhostName",
"networkInterfaces": [
{
"networkInterfaceName": "dbnic"
}
],
"osDiskName": "dbosdisk",
"dataDiskNames": {
"hanaData": [
"hanadata0",
"hanadata1"
],
"hanaLog": [
"hanalog0",
"hanalog1",
"hanalog2"
],
"usrSap": [
"usrsap0"
],
"hanaShared": [
"hanashared0",
"hanashared1"
]
}
}
]
},
"sharedStorage": {
"sharedStorageAccountName": "storageacc",
"sharedStorageAccountPrivateEndPointName": "peForxNFS"
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
},
"customResourceNames": {
"namingPatternType": "FullResourceName",
"centralServer": {
"virtualMachines": [
{
"vmName": "ascsvm",
"hostName": "ascshostName",
"networkInterfaces": [
{
"networkInterfaceName": "ascsnic"
}
],
"osDiskName": "ascsosdisk",
"dataDiskNames": {
"default": [
"ascsdisk0"
]
}
}
]
},
"applicationServer": {
"virtualMachines": [
{
"vmName": "appvm0",
"hostName": "apphostName0",
"networkInterfaces": [
{
"networkInterfaceName": "appnic0"
}
],
"osDiskName": "app0osdisk",
"dataDiskNames": {
"default": [
"app0disk0"
]
}
},
{
"vmName": "appvm1",
"hostName": "apphostName1",
"networkInterfaces": [
{
"networkInterfaceName": "appnic1"
}
],
"osDiskName": "app1osdisk",
"dataDiskNames": {
"default": [
"app1disk0"
]
}
}
],
"availabilitySetName": "appAvSet"
},
"databaseServer": {
"virtualMachines": [
{
"vmName": "dbvm",
"hostName": "dbhostName",
"networkInterfaces": [
{
"networkInterfaceName": "dbnic"
}
],
"osDiskName": "dbosdisk",
"dataDiskNames": {
"hanaData": [
"hanadata0",
"hanadata1"
],
"hanaLog": [
"hanalog0",
"hanalog1",
"hanalog2"
],
"usrSap": [
"usrsap0"
],
"hanaShared": [
"hanashared0",
"hanashared1"
]
}
}
]
},
"sharedStorage": {
"sharedStorageAccountName": "storageacc",
"sharedStorageAccountPrivateEndPointName": "peForxNFS"
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure (with OS configuration) with custom resource names for HA System with Availability Set
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilitySet"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 2
},
"customResourceNames": {
"namingPatternType": "FullResourceName",
"centralServer": {
"virtualMachines": [
{
"vmName": "ascsvm",
"hostName": "ascshostName",
"networkInterfaces": [
{
"networkInterfaceName": "ascsnic"
}
],
"osDiskName": "ascsosdisk"
},
{
"vmName": "ersvm",
"hostName": "ershostName",
"networkInterfaces": [
{
"networkInterfaceName": "ersnic"
}
],
"osDiskName": "ersosdisk"
}
],
"availabilitySetName": "csAvSet",
"loadBalancer": {
"loadBalancerName": "ascslb",
"frontendIpConfigurationNames": [
"ascsip0",
"ersip0"
],
"backendPoolNames": [
"ascsBackendPool"
],
"healthProbeNames": [
"ascsHealthProbe",
"ersHealthProbe"
]
}
},
"applicationServer": {
"virtualMachines": [
{
"vmName": "appvm0",
"hostName": "apphostName0",
"networkInterfaces": [
{
"networkInterfaceName": "appnic0"
}
],
"osDiskName": "app0osdisk",
"dataDiskNames": {
"default": [
"app0disk0"
]
}
},
{
"vmName": "appvm1",
"hostName": "apphostName1",
"networkInterfaces": [
{
"networkInterfaceName": "appnic1"
}
],
"osDiskName": "app1osdisk",
"dataDiskNames": {
"default": [
"app1disk0"
]
}
}
],
"availabilitySetName": "appAvSet"
},
"databaseServer": {
"virtualMachines": [
{
"vmName": "dbvmpr",
"hostName": "dbprhostName",
"networkInterfaces": [
{
"networkInterfaceName": "dbprnic"
}
],
"osDiskName": "dbprosdisk",
"dataDiskNames": {
"hanaData": [
"hanadatapr0",
"hanadatapr1"
],
"hanaLog": [
"hanalogpr0",
"hanalogpr1",
"hanalogpr2"
],
"usrSap": [
"usrsappr0"
],
"hanaShared": [
"hanasharedpr0",
"hanasharedpr1"
]
}
},
{
"vmName": "dbvmsr",
"hostName": "dbsrhostName",
"networkInterfaces": [
{
"networkInterfaceName": "dbsrnic"
}
],
"osDiskName": "dbsrosdisk",
"dataDiskNames": {
"hanaData": [
"hanadatasr0",
"hanadatasr1"
],
"hanaLog": [
"hanalogsr0",
"hanalogsr1",
"hanalogsr2"
],
"usrSap": [
"usrsapsr0"
],
"hanaShared": [
"hanasharedsr0",
"hanasharedsr1"
]
}
}
],
"availabilitySetName": "dbAvSet",
"loadBalancer": {
"loadBalancerName": "dblb",
"frontendIpConfigurationNames": [
"dbip"
],
"backendPoolNames": [
"dbBackendPool"
],
"healthProbeNames": [
"dbHealthProbe"
]
}
},
"sharedStorage": {
"sharedStorageAccountName": "storageacc",
"sharedStorageAccountPrivateEndPointName": "peForxNFS"
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.ApplicationServerFullResourceNames;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerFullResourceNames;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseServerFullResourceNames;
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.HighAvailabilityConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.LoadBalancerResourceNames;
import com.azure.resourcemanager.workloads.models.NetworkInterfaceResourceNames;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapHighAvailabilityType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SharedStorageResourceNames;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.ThreeTierFullResourceNames;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineResourceNames;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvSet.json
*/
/**
* Sample code: Create Infrastructure (with OS configuration) with custom resource names for HA System with
* Availability Set.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void createInfrastructureWithOSConfigurationWithCustomResourceNamesForHASystemWithAvailabilitySet(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("X00-RG")
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E16ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(2L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(6L))
.withDatabaseServer(new DatabaseConfiguration().withDatabaseType(SapDatabaseType.HANA).withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(2L))
.withHighAvailabilityConfig(new HighAvailabilityConfiguration()
.withHighAvailabilityType(SapHighAvailabilityType.AVAILABILITY_SET))
.withCustomResourceNames(
new ThreeTierFullResourceNames()
.withCentralServer(
new CentralServerFullResourceNames()
.withVirtualMachines(Arrays.asList(
new VirtualMachineResourceNames().withVmName("ascsvm")
.withHostname("ascshostName")
.withNetworkInterfaces(Arrays.asList(new NetworkInterfaceResourceNames()
.withNetworkInterfaceName("ascsnic")))
.withOsDiskName("ascsosdisk"),
new VirtualMachineResourceNames().withVmName("ersvm")
.withHostname("ershostName")
.withNetworkInterfaces(Arrays.asList(
new NetworkInterfaceResourceNames().withNetworkInterfaceName("ersnic")))
.withOsDiskName("ersosdisk")))
.withAvailabilitySetName("csAvSet")
.withLoadBalancer(new LoadBalancerResourceNames().withLoadBalancerName("ascslb")
.withFrontendIpConfigurationNames(Arrays.asList("ascsip0", "ersip0"))
.withBackendPoolNames(Arrays.asList("ascsBackendPool"))
.withHealthProbeNames(Arrays.asList("ascsHealthProbe", "ersHealthProbe"))))
.withApplicationServer(
new ApplicationServerFullResourceNames()
.withVirtualMachines(Arrays.asList(
new VirtualMachineResourceNames().withVmName("appvm0")
.withHostname("apphostName0")
.withNetworkInterfaces(Arrays.asList(new NetworkInterfaceResourceNames()
.withNetworkInterfaceName("appnic0")))
.withOsDiskName("app0osdisk")
.withDataDiskNames(mapOf("default", Arrays.asList("app0disk0"))),
new VirtualMachineResourceNames().withVmName("appvm1")
.withHostname("apphostName1")
.withNetworkInterfaces(Arrays.asList(new NetworkInterfaceResourceNames()
.withNetworkInterfaceName("appnic1")))
.withOsDiskName("app1osdisk")
.withDataDiskNames(mapOf("default", Arrays.asList("app1disk0")))))
.withAvailabilitySetName("appAvSet"))
.withDatabaseServer(
new DatabaseServerFullResourceNames()
.withVirtualMachines(Arrays.asList(
new VirtualMachineResourceNames().withVmName("dbvmpr")
.withHostname("dbprhostName")
.withNetworkInterfaces(Arrays.asList(new NetworkInterfaceResourceNames()
.withNetworkInterfaceName("dbprnic")))
.withOsDiskName("dbprosdisk").withDataDiskNames(
mapOf(
"hanaData", Arrays.asList("hanadatapr0", "hanadatapr1"), "hanaLog",
Arrays.asList("hanalogpr0", "hanalogpr1", "hanalogpr2"),
"hanaShared", Arrays.asList("hanasharedpr0", "hanasharedpr1"),
"usrSap", Arrays.asList("usrsappr0"))),
new VirtualMachineResourceNames().withVmName("dbvmsr")
.withHostname("dbsrhostName")
.withNetworkInterfaces(Arrays.asList(new NetworkInterfaceResourceNames()
.withNetworkInterfaceName("dbsrnic")))
.withOsDiskName("dbsrosdisk").withDataDiskNames(
mapOf("hanaData", Arrays.asList("hanadatasr0", "hanadatasr1"),
"hanaLog", Arrays.asList("hanalogsr0", "hanalogsr1", "hanalogsr2"),
"hanaShared", Arrays.asList("hanasharedsr0", "hanasharedsr1"),
"usrSap", Arrays.asList("usrsapsr0")))))
.withAvailabilitySetName("dbAvSet")
.withLoadBalancer(new LoadBalancerResourceNames().withLoadBalancerName("dblb")
.withFrontendIpConfigurationNames(Arrays.asList("dbip"))
.withBackendPoolNames(Arrays.asList("dbBackendPool"))
.withHealthProbeNames(Arrays.asList("dbHealthProbe"))))
.withSharedStorage(
new SharedStorageResourceNames().withSharedStorageAccountName("storageacc")
.withSharedStorageAccountPrivateEndPointName("peForxNFS"))))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_custom_full_resource_names_ha_av_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 = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvSet.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvSet.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithCustomResourceNamesForHaSystemWithAvailabilitySet() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](6),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E16ds_v4"),
},
},
CustomResourceNames: &armworkloads.ThreeTierFullResourceNames{
NamingPatternType: to.Ptr(armworkloads.NamingPatternTypeFullResourceName),
ApplicationServer: &armworkloads.ApplicationServerFullResourceNames{
AvailabilitySetName: to.Ptr("appAvSet"),
VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
{
DataDiskNames: map[string][]*string{
"default": {
to.Ptr("app0disk0")},
},
HostName: to.Ptr("apphostName0"),
NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
{
NetworkInterfaceName: to.Ptr("appnic0"),
}},
OSDiskName: to.Ptr("app0osdisk"),
VMName: to.Ptr("appvm0"),
},
{
DataDiskNames: map[string][]*string{
"default": {
to.Ptr("app1disk0")},
},
HostName: to.Ptr("apphostName1"),
NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
{
NetworkInterfaceName: to.Ptr("appnic1"),
}},
OSDiskName: to.Ptr("app1osdisk"),
VMName: to.Ptr("appvm1"),
}},
},
CentralServer: &armworkloads.CentralServerFullResourceNames{
AvailabilitySetName: to.Ptr("csAvSet"),
LoadBalancer: &armworkloads.LoadBalancerResourceNames{
BackendPoolNames: []*string{
to.Ptr("ascsBackendPool")},
FrontendIPConfigurationNames: []*string{
to.Ptr("ascsip0"),
to.Ptr("ersip0")},
HealthProbeNames: []*string{
to.Ptr("ascsHealthProbe"),
to.Ptr("ersHealthProbe")},
LoadBalancerName: to.Ptr("ascslb"),
},
VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
{
HostName: to.Ptr("ascshostName"),
NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
{
NetworkInterfaceName: to.Ptr("ascsnic"),
}},
OSDiskName: to.Ptr("ascsosdisk"),
VMName: to.Ptr("ascsvm"),
},
{
HostName: to.Ptr("ershostName"),
NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
{
NetworkInterfaceName: to.Ptr("ersnic"),
}},
OSDiskName: to.Ptr("ersosdisk"),
VMName: to.Ptr("ersvm"),
}},
},
DatabaseServer: &armworkloads.DatabaseServerFullResourceNames{
AvailabilitySetName: to.Ptr("dbAvSet"),
LoadBalancer: &armworkloads.LoadBalancerResourceNames{
BackendPoolNames: []*string{
to.Ptr("dbBackendPool")},
FrontendIPConfigurationNames: []*string{
to.Ptr("dbip")},
HealthProbeNames: []*string{
to.Ptr("dbHealthProbe")},
LoadBalancerName: to.Ptr("dblb"),
},
VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
{
DataDiskNames: map[string][]*string{
"hanaData": {
to.Ptr("hanadatapr0"),
to.Ptr("hanadatapr1")},
"hanaLog": {
to.Ptr("hanalogpr0"),
to.Ptr("hanalogpr1"),
to.Ptr("hanalogpr2")},
"hanaShared": {
to.Ptr("hanasharedpr0"),
to.Ptr("hanasharedpr1")},
"usrSap": {
to.Ptr("usrsappr0")},
},
HostName: to.Ptr("dbprhostName"),
NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
{
NetworkInterfaceName: to.Ptr("dbprnic"),
}},
OSDiskName: to.Ptr("dbprosdisk"),
VMName: to.Ptr("dbvmpr"),
},
{
DataDiskNames: map[string][]*string{
"hanaData": {
to.Ptr("hanadatasr0"),
to.Ptr("hanadatasr1")},
"hanaLog": {
to.Ptr("hanalogsr0"),
to.Ptr("hanalogsr1"),
to.Ptr("hanalogsr2")},
"hanaShared": {
to.Ptr("hanasharedsr0"),
to.Ptr("hanasharedsr1")},
"usrSap": {
to.Ptr("usrsapsr0")},
},
HostName: to.Ptr("dbsrhostName"),
NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
{
NetworkInterfaceName: to.Ptr("dbsrnic"),
}},
OSDiskName: to.Ptr("dbsrosdisk"),
VMName: to.Ptr("dbvmsr"),
}},
},
SharedStorage: &armworkloads.SharedStorageResourceNames{
SharedStorageAccountName: to.Ptr("storageacc"),
SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet),
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](6),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E16ds_v4"),
// },
// },
// CustomResourceNames: &armworkloads.ThreeTierFullResourceNames{
// NamingPatternType: to.Ptr(armworkloads.NamingPatternTypeFullResourceName),
// ApplicationServer: &armworkloads.ApplicationServerFullResourceNames{
// AvailabilitySetName: to.Ptr("appAvSet"),
// VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
// {
// DataDiskNames: map[string][]*string{
// "default": []*string{
// to.Ptr("app0disk0")},
// },
// HostName: to.Ptr("apphostName0"),
// NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
// {
// NetworkInterfaceName: to.Ptr("appnic0"),
// }},
// OSDiskName: to.Ptr("app0osdisk"),
// VMName: to.Ptr("appvm0"),
// },
// {
// DataDiskNames: map[string][]*string{
// "default": []*string{
// to.Ptr("app1disk0")},
// },
// HostName: to.Ptr("apphostName1"),
// NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
// {
// NetworkInterfaceName: to.Ptr("appnic1"),
// }},
// OSDiskName: to.Ptr("app1osdisk"),
// VMName: to.Ptr("appvm1"),
// }},
// },
// CentralServer: &armworkloads.CentralServerFullResourceNames{
// AvailabilitySetName: to.Ptr("csAvSet"),
// LoadBalancer: &armworkloads.LoadBalancerResourceNames{
// BackendPoolNames: []*string{
// to.Ptr("ascsBackendPool")},
// FrontendIPConfigurationNames: []*string{
// to.Ptr("ascsip0"),
// to.Ptr("ersip0")},
// HealthProbeNames: []*string{
// to.Ptr("ascsHealthProbe"),
// to.Ptr("ersHealthProbe")},
// LoadBalancerName: to.Ptr("ascslb"),
// },
// VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
// {
// HostName: to.Ptr("ascshostName"),
// NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
// {
// NetworkInterfaceName: to.Ptr("ascsnic"),
// }},
// OSDiskName: to.Ptr("ascsosdisk"),
// VMName: to.Ptr("ascsvm"),
// },
// {
// HostName: to.Ptr("ershostName"),
// NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
// {
// NetworkInterfaceName: to.Ptr("ersnic"),
// }},
// OSDiskName: to.Ptr("ersosdisk"),
// VMName: to.Ptr("ersvm"),
// }},
// },
// DatabaseServer: &armworkloads.DatabaseServerFullResourceNames{
// AvailabilitySetName: to.Ptr("dbAvSet"),
// LoadBalancer: &armworkloads.LoadBalancerResourceNames{
// BackendPoolNames: []*string{
// to.Ptr("dbBackendPool")},
// FrontendIPConfigurationNames: []*string{
// to.Ptr("dbip")},
// HealthProbeNames: []*string{
// to.Ptr("dbHealthProbe")},
// LoadBalancerName: to.Ptr("dblb"),
// },
// VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
// {
// DataDiskNames: map[string][]*string{
// "hanaData": []*string{
// to.Ptr("hanadatapr0"),
// to.Ptr("hanadatapr1")},
// "hanaLog": []*string{
// to.Ptr("hanalogpr0"),
// to.Ptr("hanalogpr1"),
// to.Ptr("hanalogpr2")},
// "hanaShared": []*string{
// to.Ptr("hanasharedpr0"),
// to.Ptr("hanasharedpr1")},
// "usrSap": []*string{
// to.Ptr("usrsappr0")},
// },
// HostName: to.Ptr("dbprhostName"),
// NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
// {
// NetworkInterfaceName: to.Ptr("dbprnic"),
// }},
// OSDiskName: to.Ptr("dbprosdisk"),
// VMName: to.Ptr("dbvmpr"),
// },
// {
// DataDiskNames: map[string][]*string{
// "hanaData": []*string{
// to.Ptr("hanadatasr0"),
// to.Ptr("hanadatasr1")},
// "hanaLog": []*string{
// to.Ptr("hanalogsr0"),
// to.Ptr("hanalogsr1"),
// to.Ptr("hanalogsr2")},
// "hanaShared": []*string{
// to.Ptr("hanasharedsr0"),
// to.Ptr("hanasharedsr1")},
// "usrSap": []*string{
// to.Ptr("usrsapsr0")},
// },
// HostName: to.Ptr("dbsrhostName"),
// NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
// {
// NetworkInterfaceName: to.Ptr("dbsrnic"),
// }},
// OSDiskName: to.Ptr("dbsrosdisk"),
// VMName: to.Ptr("dbvmsr"),
// }},
// },
// SharedStorage: &armworkloads.SharedStorageResourceNames{
// SharedStorageAccountName: to.Ptr("storageacc"),
// SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
// HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet),
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvSet.json
*/
async function createInfrastructureWithOSConfigurationWithCustomResourceNamesForHaSystemWithAvailabilitySet() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
applicationServer: {
instanceCount: 6,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
centralServer: {
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E16ds_v4",
},
},
customResourceNames: {
applicationServer: {
availabilitySetName: "appAvSet",
virtualMachines: [
{
dataDiskNames: { default: ["app0disk0"] },
hostName: "apphostName0",
networkInterfaces: [{ networkInterfaceName: "appnic0" }],
osDiskName: "app0osdisk",
vmName: "appvm0",
},
{
dataDiskNames: { default: ["app1disk0"] },
hostName: "apphostName1",
networkInterfaces: [{ networkInterfaceName: "appnic1" }],
osDiskName: "app1osdisk",
vmName: "appvm1",
},
],
},
centralServer: {
availabilitySetName: "csAvSet",
loadBalancer: {
backendPoolNames: ["ascsBackendPool"],
frontendIpConfigurationNames: ["ascsip0", "ersip0"],
healthProbeNames: ["ascsHealthProbe", "ersHealthProbe"],
loadBalancerName: "ascslb",
},
virtualMachines: [
{
hostName: "ascshostName",
networkInterfaces: [{ networkInterfaceName: "ascsnic" }],
osDiskName: "ascsosdisk",
vmName: "ascsvm",
},
{
hostName: "ershostName",
networkInterfaces: [{ networkInterfaceName: "ersnic" }],
osDiskName: "ersosdisk",
vmName: "ersvm",
},
],
},
databaseServer: {
availabilitySetName: "dbAvSet",
loadBalancer: {
backendPoolNames: ["dbBackendPool"],
frontendIpConfigurationNames: ["dbip"],
healthProbeNames: ["dbHealthProbe"],
loadBalancerName: "dblb",
},
virtualMachines: [
{
dataDiskNames: {
hanaData: ["hanadatapr0", "hanadatapr1"],
hanaLog: ["hanalogpr0", "hanalogpr1", "hanalogpr2"],
hanaShared: ["hanasharedpr0", "hanasharedpr1"],
usrSap: ["usrsappr0"],
},
hostName: "dbprhostName",
networkInterfaces: [{ networkInterfaceName: "dbprnic" }],
osDiskName: "dbprosdisk",
vmName: "dbvmpr",
},
{
dataDiskNames: {
hanaData: ["hanadatasr0", "hanadatasr1"],
hanaLog: ["hanalogsr0", "hanalogsr1", "hanalogsr2"],
hanaShared: ["hanasharedsr0", "hanasharedsr1"],
usrSap: ["usrsapsr0"],
},
hostName: "dbsrhostName",
networkInterfaces: [{ networkInterfaceName: "dbsrnic" }],
osDiskName: "dbsrosdisk",
vmName: "dbvmsr",
},
],
},
namingPatternType: "FullResourceName",
sharedStorage: {
sharedStorageAccountName: "storageacc",
sharedStorageAccountPrivateEndPointName: "peForxNFS",
},
},
databaseServer: {
databaseType: "HANA",
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
highAvailabilityConfig: { highAvailabilityType: "AvailabilitySet" },
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
},
environment: "Prod",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvSet.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("X00-RG", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E16ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 2L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 6L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 2L)
{
DatabaseType = SapDatabaseType.Hana,
})
{
HighAvailabilityType = SapHighAvailabilityType.AvailabilitySet,
CustomResourceNames = new ThreeTierFullResourceNames
{
CentralServer = new CentralServerFullResourceNames
{
VirtualMachines = {new VirtualMachineResourceNames
{
VmName = "ascsvm",
HostName = "ascshostName",
NetworkInterfaces = {new NetworkInterfaceResourceNames
{
NetworkInterfaceName = "ascsnic",
}},
OSDiskName = "ascsosdisk",
}, new VirtualMachineResourceNames
{
VmName = "ersvm",
HostName = "ershostName",
NetworkInterfaces = {new NetworkInterfaceResourceNames
{
NetworkInterfaceName = "ersnic",
}},
OSDiskName = "ersosdisk",
}},
AvailabilitySetName = "csAvSet",
LoadBalancer = new LoadBalancerResourceNames
{
LoadBalancerName = "ascslb",
FrontendIPConfigurationNames = { "ascsip0", "ersip0" },
BackendPoolNames = { "ascsBackendPool" },
HealthProbeNames = { "ascsHealthProbe", "ersHealthProbe" },
},
},
ApplicationServer = new ApplicationServerFullResourceNames
{
VirtualMachines = {new VirtualMachineResourceNames
{
VmName = "appvm0",
HostName = "apphostName0",
NetworkInterfaces = {new NetworkInterfaceResourceNames
{
NetworkInterfaceName = "appnic0",
}},
OSDiskName = "app0osdisk",
DataDiskNames =
{
["default"] = new string[]{"app0disk0"}
},
}, new VirtualMachineResourceNames
{
VmName = "appvm1",
HostName = "apphostName1",
NetworkInterfaces = {new NetworkInterfaceResourceNames
{
NetworkInterfaceName = "appnic1",
}},
OSDiskName = "app1osdisk",
DataDiskNames =
{
["default"] = new string[]{"app1disk0"}
},
}},
AvailabilitySetName = "appAvSet",
},
DatabaseServer = new DatabaseServerFullResourceNames
{
VirtualMachines = {new VirtualMachineResourceNames
{
VmName = "dbvmpr",
HostName = "dbprhostName",
NetworkInterfaces = {new NetworkInterfaceResourceNames
{
NetworkInterfaceName = "dbprnic",
}},
OSDiskName = "dbprosdisk",
DataDiskNames =
{
["hanaData"] = new string[]{"hanadatapr0", "hanadatapr1"},
["hanaLog"] = new string[]{"hanalogpr0", "hanalogpr1", "hanalogpr2"},
["hanaShared"] = new string[]{"hanasharedpr0", "hanasharedpr1"},
["usrSap"] = new string[]{"usrsappr0"}
},
}, new VirtualMachineResourceNames
{
VmName = "dbvmsr",
HostName = "dbsrhostName",
NetworkInterfaces = {new NetworkInterfaceResourceNames
{
NetworkInterfaceName = "dbsrnic",
}},
OSDiskName = "dbsrosdisk",
DataDiskNames =
{
["hanaData"] = new string[]{"hanadatasr0", "hanadatasr1"},
["hanaLog"] = new string[]{"hanalogsr0", "hanalogsr1", "hanalogsr2"},
["hanaShared"] = new string[]{"hanasharedsr0", "hanasharedsr1"},
["usrSap"] = new string[]{"usrsapsr0"}
},
}},
AvailabilitySetName = "dbAvSet",
LoadBalancer = new LoadBalancerResourceNames
{
LoadBalancerName = "dblb",
FrontendIPConfigurationNames = { "dbip" },
BackendPoolNames = { "dbBackendPool" },
HealthProbeNames = { "dbHealthProbe" },
},
},
SharedStorage = new SharedStorageResourceNames
{
SharedStorageAccountName = "storageacc",
SharedStorageAccountPrivateEndPointName = "peForxNFS",
},
},
},
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilitySet"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"customResourceNames": {
"namingPatternType": "FullResourceName",
"centralServer": {
"virtualMachines": [
{
"vmName": "ascsvm",
"hostName": "ascshostName",
"networkInterfaces": [
{
"networkInterfaceName": "ascsnic"
}
],
"osDiskName": "ascsosdisk"
},
{
"vmName": "ersvm",
"hostName": "ershostName",
"networkInterfaces": [
{
"networkInterfaceName": "ersnic"
}
],
"osDiskName": "ersosdisk"
}
],
"availabilitySetName": "csAvSet",
"loadBalancer": {
"loadBalancerName": "ascslb",
"frontendIpConfigurationNames": [
"ascsip0",
"ersip0"
],
"backendPoolNames": [
"ascsBackendPool"
],
"healthProbeNames": [
"ascsHealthProbe",
"ersHealthProbe"
]
}
},
"applicationServer": {
"virtualMachines": [
{
"vmName": "appvm0",
"hostName": "apphostName0",
"networkInterfaces": [
{
"networkInterfaceName": "appnic0"
}
],
"osDiskName": "app0osdisk",
"dataDiskNames": {
"default": [
"app0disk0"
]
}
},
{
"vmName": "appvm1",
"hostName": "apphostName1",
"networkInterfaces": [
{
"networkInterfaceName": "appnic1"
}
],
"osDiskName": "app1osdisk",
"dataDiskNames": {
"default": [
"app1disk0"
]
}
}
],
"availabilitySetName": "appAvSet"
},
"databaseServer": {
"virtualMachines": [
{
"vmName": "dbvmpr",
"hostName": "dbprhostName",
"networkInterfaces": [
{
"networkInterfaceName": "dbprnic"
}
],
"osDiskName": "dbprosdisk",
"dataDiskNames": {
"hanaData": [
"hanadatapr0",
"hanadatapr1"
],
"hanaLog": [
"hanalogpr0",
"hanalogpr1",
"hanalogpr2"
],
"usrSap": [
"usrsappr0"
],
"hanaShared": [
"hanasharedpr0",
"hanasharedpr1"
]
}
},
{
"vmName": "dbvmsr",
"hostName": "dbsrhostName",
"networkInterfaces": [
{
"networkInterfaceName": "dbsrnic"
}
],
"osDiskName": "dbsrosdisk",
"dataDiskNames": {
"hanaData": [
"hanadatasr0",
"hanadatasr1"
],
"hanaLog": [
"hanalogsr0",
"hanalogsr1",
"hanalogsr2"
],
"usrSap": [
"usrsapsr0"
],
"hanaShared": [
"hanasharedsr0",
"hanasharedsr1"
]
}
}
],
"availabilitySetName": "dbAvSet",
"loadBalancer": {
"loadBalancerName": "dblb",
"frontendIpConfigurationNames": [
"dbip"
],
"backendPoolNames": [
"dbBackendPool"
],
"healthProbeNames": [
"dbHealthProbe"
]
}
},
"sharedStorage": {
"sharedStorageAccountName": "storageacc",
"sharedStorageAccountPrivateEndPointName": "peForxNFS"
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilitySet"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"customResourceNames": {
"namingPatternType": "FullResourceName",
"centralServer": {
"virtualMachines": [
{
"vmName": "ascsvm",
"hostName": "ascshostName",
"networkInterfaces": [
{
"networkInterfaceName": "ascsnic"
}
],
"osDiskName": "ascsosdisk"
},
{
"vmName": "ersvm",
"hostName": "ershostName",
"networkInterfaces": [
{
"networkInterfaceName": "ersnic"
}
],
"osDiskName": "ersosdisk"
}
],
"availabilitySetName": "csAvSet",
"loadBalancer": {
"loadBalancerName": "ascslb",
"frontendIpConfigurationNames": [
"ascsip0",
"ersip0"
],
"backendPoolNames": [
"ascsBackendPool"
],
"healthProbeNames": [
"ascsHealthProbe",
"ersHealthProbe"
]
}
},
"applicationServer": {
"virtualMachines": [
{
"vmName": "appvm0",
"hostName": "apphostName0",
"networkInterfaces": [
{
"networkInterfaceName": "appnic0"
}
],
"osDiskName": "app0osdisk",
"dataDiskNames": {
"default": [
"app0disk0"
]
}
},
{
"vmName": "appvm1",
"hostName": "apphostName1",
"networkInterfaces": [
{
"networkInterfaceName": "appnic1"
}
],
"osDiskName": "app1osdisk",
"dataDiskNames": {
"default": [
"app1disk0"
]
}
}
],
"availabilitySetName": "appAvSet"
},
"databaseServer": {
"virtualMachines": [
{
"vmName": "dbvmpr",
"hostName": "dbprhostName",
"networkInterfaces": [
{
"networkInterfaceName": "dbprnic"
}
],
"osDiskName": "dbprosdisk",
"dataDiskNames": {
"hanaData": [
"hanadatapr0",
"hanadatapr1"
],
"hanaLog": [
"hanalogpr0",
"hanalogpr1",
"hanalogpr2"
],
"usrSap": [
"usrsappr0"
],
"hanaShared": [
"hanasharedpr0",
"hanasharedpr1"
]
}
},
{
"vmName": "dbvmsr",
"hostName": "dbsrhostName",
"networkInterfaces": [
{
"networkInterfaceName": "dbsrnic"
}
],
"osDiskName": "dbsrosdisk",
"dataDiskNames": {
"hanaData": [
"hanadatasr0",
"hanadatasr1"
],
"hanaLog": [
"hanalogsr0",
"hanalogsr1",
"hanalogsr2"
],
"usrSap": [
"usrsapsr0"
],
"hanaShared": [
"hanasharedsr0",
"hanasharedsr1"
]
}
}
],
"availabilitySetName": "dbAvSet",
"loadBalancer": {
"loadBalancerName": "dblb",
"frontendIpConfigurationNames": [
"dbip"
],
"backendPoolNames": [
"dbBackendPool"
],
"healthProbeNames": [
"dbHealthProbe"
]
}
},
"sharedStorage": {
"sharedStorageAccountName": "storageacc",
"sharedStorageAccountPrivateEndPointName": "peForxNFS"
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure (with OS configuration) with custom resource names for HA system with Availability Zone
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilityZone"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 2
},
"customResourceNames": {
"namingPatternType": "FullResourceName",
"centralServer": {
"virtualMachines": [
{
"vmName": "ascsvm",
"hostName": "ascshostName",
"networkInterfaces": [
{
"networkInterfaceName": "ascsnic"
}
],
"osDiskName": "ascsosdisk"
},
{
"vmName": "ersvm",
"hostName": "ershostName",
"networkInterfaces": [
{
"networkInterfaceName": "ersnic"
}
],
"osDiskName": "ersosdisk"
}
],
"loadBalancer": {
"loadBalancerName": "ascslb",
"frontendIpConfigurationNames": [
"ascsip0",
"ersip0"
],
"backendPoolNames": [
"ascsBackendPool"
],
"healthProbeNames": [
"ascsHealthProbe",
"ersHealthProbe"
]
}
},
"applicationServer": {
"virtualMachines": [
{
"vmName": "appvm0",
"hostName": "apphostName0",
"networkInterfaces": [
{
"networkInterfaceName": "appnic0"
}
],
"osDiskName": "app0osdisk",
"dataDiskNames": {
"default": [
"app0disk0"
]
}
},
{
"vmName": "appvm1",
"hostName": "apphostName1",
"networkInterfaces": [
{
"networkInterfaceName": "appnic1"
}
],
"osDiskName": "app1osdisk",
"dataDiskNames": {
"default": [
"app1disk0"
]
}
}
]
},
"databaseServer": {
"virtualMachines": [
{
"vmName": "dbvmpr",
"hostName": "dbprhostName",
"networkInterfaces": [
{
"networkInterfaceName": "dbprnic"
}
],
"osDiskName": "dbprosdisk",
"dataDiskNames": {
"hanaData": [
"hanadatapr0",
"hanadatapr1"
],
"hanaLog": [
"hanalogpr0",
"hanalogpr1",
"hanalogpr2"
],
"usrSap": [
"usrsappr0"
],
"hanaShared": [
"hanasharedpr0",
"hanasharedpr1"
]
}
},
{
"vmName": "dbvmsr",
"hostName": "dbsrhostName",
"networkInterfaces": [
{
"networkInterfaceName": "dbsrnic"
}
],
"osDiskName": "dbsrosdisk",
"dataDiskNames": {
"hanaData": [
"hanadatasr0",
"hanadatasr1"
],
"hanaLog": [
"hanalogsr0",
"hanalogsr1",
"hanalogsr2"
],
"usrSap": [
"usrsapsr0"
],
"hanaShared": [
"hanasharedsr0",
"hanasharedsr1"
]
}
}
],
"loadBalancer": {
"loadBalancerName": "dblb",
"frontendIpConfigurationNames": [
"dbip"
],
"backendPoolNames": [
"dbBackendPool"
],
"healthProbeNames": [
"dbHealthProbe"
]
}
},
"sharedStorage": {
"sharedStorageAccountName": "storageacc",
"sharedStorageAccountPrivateEndPointName": "peForxNFS"
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.ApplicationServerFullResourceNames;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerFullResourceNames;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseServerFullResourceNames;
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.HighAvailabilityConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.LoadBalancerResourceNames;
import com.azure.resourcemanager.workloads.models.NetworkInterfaceResourceNames;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapHighAvailabilityType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SharedStorageResourceNames;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.ThreeTierFullResourceNames;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineResourceNames;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvZone.json
*/
/**
* Sample code: Create Infrastructure (with OS configuration) with custom resource names for HA system with
* Availability Zone.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void createInfrastructureWithOSConfigurationWithCustomResourceNamesForHASystemWithAvailabilityZone(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("X00-RG")
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E16ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(2L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(6L))
.withDatabaseServer(new DatabaseConfiguration().withDatabaseType(SapDatabaseType.HANA).withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(2L))
.withHighAvailabilityConfig(new HighAvailabilityConfiguration()
.withHighAvailabilityType(SapHighAvailabilityType.AVAILABILITY_ZONE))
.withCustomResourceNames(
new ThreeTierFullResourceNames()
.withCentralServer(
new CentralServerFullResourceNames()
.withVirtualMachines(Arrays.asList(
new VirtualMachineResourceNames().withVmName("ascsvm")
.withHostname("ascshostName")
.withNetworkInterfaces(Arrays.asList(new NetworkInterfaceResourceNames()
.withNetworkInterfaceName("ascsnic")))
.withOsDiskName("ascsosdisk"),
new VirtualMachineResourceNames()
.withVmName("ersvm").withHostname("ershostName")
.withNetworkInterfaces(Arrays.asList(
new NetworkInterfaceResourceNames().withNetworkInterfaceName("ersnic")))
.withOsDiskName("ersosdisk")))
.withLoadBalancer(new LoadBalancerResourceNames().withLoadBalancerName("ascslb")
.withFrontendIpConfigurationNames(Arrays.asList("ascsip0", "ersip0"))
.withBackendPoolNames(Arrays.asList("ascsBackendPool"))
.withHealthProbeNames(Arrays.asList("ascsHealthProbe", "ersHealthProbe"))))
.withApplicationServer(new ApplicationServerFullResourceNames()
.withVirtualMachines(Arrays.asList(
new VirtualMachineResourceNames()
.withVmName("appvm0").withHostname("apphostName0")
.withNetworkInterfaces(Arrays.asList(
new NetworkInterfaceResourceNames().withNetworkInterfaceName("appnic0")))
.withOsDiskName("app0osdisk")
.withDataDiskNames(mapOf("default", Arrays.asList("app0disk0"))),
new VirtualMachineResourceNames().withVmName("appvm1").withHostname("apphostName1")
.withNetworkInterfaces(Arrays.asList(
new NetworkInterfaceResourceNames().withNetworkInterfaceName("appnic1")))
.withOsDiskName("app1osdisk")
.withDataDiskNames(mapOf("default", Arrays.asList("app1disk0"))))))
.withDatabaseServer(
new DatabaseServerFullResourceNames()
.withVirtualMachines(Arrays.asList(
new VirtualMachineResourceNames().withVmName("dbvmpr")
.withHostname("dbprhostName")
.withNetworkInterfaces(Arrays.asList(new NetworkInterfaceResourceNames()
.withNetworkInterfaceName("dbprnic")))
.withOsDiskName("dbprosdisk").withDataDiskNames(
mapOf("hanaData", Arrays.asList("hanadatapr0", "hanadatapr1"),
"hanaLog", Arrays.asList("hanalogpr0", "hanalogpr1", "hanalogpr2"),
"hanaShared", Arrays.asList("hanasharedpr0", "hanasharedpr1"),
"usrSap", Arrays.asList("usrsappr0"))),
new VirtualMachineResourceNames().withVmName("dbvmsr")
.withHostname("dbsrhostName")
.withNetworkInterfaces(Arrays.asList(new NetworkInterfaceResourceNames()
.withNetworkInterfaceName("dbsrnic")))
.withOsDiskName("dbsrosdisk").withDataDiskNames(
mapOf("hanaData", Arrays.asList("hanadatasr0", "hanadatasr1"),
"hanaLog", Arrays.asList("hanalogsr0", "hanalogsr1", "hanalogsr2"),
"hanaShared", Arrays.asList("hanasharedsr0", "hanasharedsr1"),
"usrSap", Arrays.asList("usrsapsr0")))))
.withLoadBalancer(new LoadBalancerResourceNames().withLoadBalancerName("dblb")
.withFrontendIpConfigurationNames(Arrays.asList("dbip"))
.withBackendPoolNames(Arrays.asList("dbBackendPool"))
.withHealthProbeNames(Arrays.asList("dbHealthProbe"))))
.withSharedStorage(
new SharedStorageResourceNames().withSharedStorageAccountName("storageacc")
.withSharedStorageAccountPrivateEndPointName("peForxNFS"))))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_custom_full_resource_names_ha_av_zone.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvZone.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvZone.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithCustomResourceNamesForHaSystemWithAvailabilityZone() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](6),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E16ds_v4"),
},
},
CustomResourceNames: &armworkloads.ThreeTierFullResourceNames{
NamingPatternType: to.Ptr(armworkloads.NamingPatternTypeFullResourceName),
ApplicationServer: &armworkloads.ApplicationServerFullResourceNames{
VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
{
DataDiskNames: map[string][]*string{
"default": {
to.Ptr("app0disk0")},
},
HostName: to.Ptr("apphostName0"),
NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
{
NetworkInterfaceName: to.Ptr("appnic0"),
}},
OSDiskName: to.Ptr("app0osdisk"),
VMName: to.Ptr("appvm0"),
},
{
DataDiskNames: map[string][]*string{
"default": {
to.Ptr("app1disk0")},
},
HostName: to.Ptr("apphostName1"),
NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
{
NetworkInterfaceName: to.Ptr("appnic1"),
}},
OSDiskName: to.Ptr("app1osdisk"),
VMName: to.Ptr("appvm1"),
}},
},
CentralServer: &armworkloads.CentralServerFullResourceNames{
LoadBalancer: &armworkloads.LoadBalancerResourceNames{
BackendPoolNames: []*string{
to.Ptr("ascsBackendPool")},
FrontendIPConfigurationNames: []*string{
to.Ptr("ascsip0"),
to.Ptr("ersip0")},
HealthProbeNames: []*string{
to.Ptr("ascsHealthProbe"),
to.Ptr("ersHealthProbe")},
LoadBalancerName: to.Ptr("ascslb"),
},
VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
{
HostName: to.Ptr("ascshostName"),
NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
{
NetworkInterfaceName: to.Ptr("ascsnic"),
}},
OSDiskName: to.Ptr("ascsosdisk"),
VMName: to.Ptr("ascsvm"),
},
{
HostName: to.Ptr("ershostName"),
NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
{
NetworkInterfaceName: to.Ptr("ersnic"),
}},
OSDiskName: to.Ptr("ersosdisk"),
VMName: to.Ptr("ersvm"),
}},
},
DatabaseServer: &armworkloads.DatabaseServerFullResourceNames{
LoadBalancer: &armworkloads.LoadBalancerResourceNames{
BackendPoolNames: []*string{
to.Ptr("dbBackendPool")},
FrontendIPConfigurationNames: []*string{
to.Ptr("dbip")},
HealthProbeNames: []*string{
to.Ptr("dbHealthProbe")},
LoadBalancerName: to.Ptr("dblb"),
},
VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
{
DataDiskNames: map[string][]*string{
"hanaData": {
to.Ptr("hanadatapr0"),
to.Ptr("hanadatapr1")},
"hanaLog": {
to.Ptr("hanalogpr0"),
to.Ptr("hanalogpr1"),
to.Ptr("hanalogpr2")},
"hanaShared": {
to.Ptr("hanasharedpr0"),
to.Ptr("hanasharedpr1")},
"usrSap": {
to.Ptr("usrsappr0")},
},
HostName: to.Ptr("dbprhostName"),
NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
{
NetworkInterfaceName: to.Ptr("dbprnic"),
}},
OSDiskName: to.Ptr("dbprosdisk"),
VMName: to.Ptr("dbvmpr"),
},
{
DataDiskNames: map[string][]*string{
"hanaData": {
to.Ptr("hanadatasr0"),
to.Ptr("hanadatasr1")},
"hanaLog": {
to.Ptr("hanalogsr0"),
to.Ptr("hanalogsr1"),
to.Ptr("hanalogsr2")},
"hanaShared": {
to.Ptr("hanasharedsr0"),
to.Ptr("hanasharedsr1")},
"usrSap": {
to.Ptr("usrsapsr0")},
},
HostName: to.Ptr("dbsrhostName"),
NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
{
NetworkInterfaceName: to.Ptr("dbsrnic"),
}},
OSDiskName: to.Ptr("dbsrosdisk"),
VMName: to.Ptr("dbvmsr"),
}},
},
SharedStorage: &armworkloads.SharedStorageResourceNames{
SharedStorageAccountName: to.Ptr("storageacc"),
SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone),
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](6),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E16ds_v4"),
// },
// },
// CustomResourceNames: &armworkloads.ThreeTierFullResourceNames{
// NamingPatternType: to.Ptr(armworkloads.NamingPatternTypeFullResourceName),
// ApplicationServer: &armworkloads.ApplicationServerFullResourceNames{
// VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
// {
// DataDiskNames: map[string][]*string{
// "default": []*string{
// to.Ptr("app0disk0")},
// },
// HostName: to.Ptr("apphostName0"),
// NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
// {
// NetworkInterfaceName: to.Ptr("appnic0"),
// }},
// OSDiskName: to.Ptr("app0osdisk"),
// VMName: to.Ptr("appvm0"),
// },
// {
// DataDiskNames: map[string][]*string{
// "default": []*string{
// to.Ptr("app1disk0")},
// },
// HostName: to.Ptr("apphostName1"),
// NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
// {
// NetworkInterfaceName: to.Ptr("appnic1"),
// }},
// OSDiskName: to.Ptr("app1osdisk"),
// VMName: to.Ptr("appvm1"),
// }},
// },
// CentralServer: &armworkloads.CentralServerFullResourceNames{
// LoadBalancer: &armworkloads.LoadBalancerResourceNames{
// BackendPoolNames: []*string{
// to.Ptr("ascsBackendPool")},
// FrontendIPConfigurationNames: []*string{
// to.Ptr("ascsip0"),
// to.Ptr("ersip0")},
// HealthProbeNames: []*string{
// to.Ptr("ascsHealthProbe"),
// to.Ptr("ersHealthProbe")},
// LoadBalancerName: to.Ptr("ascslb"),
// },
// VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
// {
// HostName: to.Ptr("ascshostName"),
// NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
// {
// NetworkInterfaceName: to.Ptr("ascsnic"),
// }},
// OSDiskName: to.Ptr("ascsosdisk"),
// VMName: to.Ptr("ascsvm"),
// },
// {
// HostName: to.Ptr("ershostName"),
// NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
// {
// NetworkInterfaceName: to.Ptr("ersnic"),
// }},
// OSDiskName: to.Ptr("ersosdisk"),
// VMName: to.Ptr("ersvm"),
// }},
// },
// DatabaseServer: &armworkloads.DatabaseServerFullResourceNames{
// LoadBalancer: &armworkloads.LoadBalancerResourceNames{
// BackendPoolNames: []*string{
// to.Ptr("dbBackendPool")},
// FrontendIPConfigurationNames: []*string{
// to.Ptr("dbip")},
// HealthProbeNames: []*string{
// to.Ptr("dbHealthProbe")},
// LoadBalancerName: to.Ptr("dblb"),
// },
// VirtualMachines: []*armworkloads.VirtualMachineResourceNames{
// {
// DataDiskNames: map[string][]*string{
// "hanaData": []*string{
// to.Ptr("hanadatapr0"),
// to.Ptr("hanadatapr1")},
// "hanaLog": []*string{
// to.Ptr("hanalogpr0"),
// to.Ptr("hanalogpr1"),
// to.Ptr("hanalogpr2")},
// "hanaShared": []*string{
// to.Ptr("hanasharedpr0"),
// to.Ptr("hanasharedpr1")},
// "usrSap": []*string{
// to.Ptr("usrsappr0")},
// },
// HostName: to.Ptr("dbprhostName"),
// NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
// {
// NetworkInterfaceName: to.Ptr("dbprnic"),
// }},
// OSDiskName: to.Ptr("dbprosdisk"),
// VMName: to.Ptr("dbvmpr"),
// },
// {
// DataDiskNames: map[string][]*string{
// "hanaData": []*string{
// to.Ptr("hanadatasr0"),
// to.Ptr("hanadatasr1")},
// "hanaLog": []*string{
// to.Ptr("hanalogsr0"),
// to.Ptr("hanalogsr1"),
// to.Ptr("hanalogsr2")},
// "hanaShared": []*string{
// to.Ptr("hanasharedsr0"),
// to.Ptr("hanasharedsr1")},
// "usrSap": []*string{
// to.Ptr("usrsapsr0")},
// },
// HostName: to.Ptr("dbsrhostName"),
// NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
// {
// NetworkInterfaceName: to.Ptr("dbsrnic"),
// }},
// OSDiskName: to.Ptr("dbsrosdisk"),
// VMName: to.Ptr("dbvmsr"),
// }},
// },
// SharedStorage: &armworkloads.SharedStorageResourceNames{
// SharedStorageAccountName: to.Ptr("storageacc"),
// SharedStorageAccountPrivateEndPointName: to.Ptr("peForxNFS"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
// HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone),
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvZone.json
*/
async function createInfrastructureWithOSConfigurationWithCustomResourceNamesForHaSystemWithAvailabilityZone() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
applicationServer: {
instanceCount: 6,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
centralServer: {
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E16ds_v4",
},
},
customResourceNames: {
applicationServer: {
virtualMachines: [
{
dataDiskNames: { default: ["app0disk0"] },
hostName: "apphostName0",
networkInterfaces: [{ networkInterfaceName: "appnic0" }],
osDiskName: "app0osdisk",
vmName: "appvm0",
},
{
dataDiskNames: { default: ["app1disk0"] },
hostName: "apphostName1",
networkInterfaces: [{ networkInterfaceName: "appnic1" }],
osDiskName: "app1osdisk",
vmName: "appvm1",
},
],
},
centralServer: {
loadBalancer: {
backendPoolNames: ["ascsBackendPool"],
frontendIpConfigurationNames: ["ascsip0", "ersip0"],
healthProbeNames: ["ascsHealthProbe", "ersHealthProbe"],
loadBalancerName: "ascslb",
},
virtualMachines: [
{
hostName: "ascshostName",
networkInterfaces: [{ networkInterfaceName: "ascsnic" }],
osDiskName: "ascsosdisk",
vmName: "ascsvm",
},
{
hostName: "ershostName",
networkInterfaces: [{ networkInterfaceName: "ersnic" }],
osDiskName: "ersosdisk",
vmName: "ersvm",
},
],
},
databaseServer: {
loadBalancer: {
backendPoolNames: ["dbBackendPool"],
frontendIpConfigurationNames: ["dbip"],
healthProbeNames: ["dbHealthProbe"],
loadBalancerName: "dblb",
},
virtualMachines: [
{
dataDiskNames: {
hanaData: ["hanadatapr0", "hanadatapr1"],
hanaLog: ["hanalogpr0", "hanalogpr1", "hanalogpr2"],
hanaShared: ["hanasharedpr0", "hanasharedpr1"],
usrSap: ["usrsappr0"],
},
hostName: "dbprhostName",
networkInterfaces: [{ networkInterfaceName: "dbprnic" }],
osDiskName: "dbprosdisk",
vmName: "dbvmpr",
},
{
dataDiskNames: {
hanaData: ["hanadatasr0", "hanadatasr1"],
hanaLog: ["hanalogsr0", "hanalogsr1", "hanalogsr2"],
hanaShared: ["hanasharedsr0", "hanasharedsr1"],
usrSap: ["usrsapsr0"],
},
hostName: "dbsrhostName",
networkInterfaces: [{ networkInterfaceName: "dbsrnic" }],
osDiskName: "dbsrosdisk",
vmName: "dbvmsr",
},
],
},
namingPatternType: "FullResourceName",
sharedStorage: {
sharedStorageAccountName: "storageacc",
sharedStorageAccountPrivateEndPointName: "peForxNFS",
},
},
databaseServer: {
databaseType: "HANA",
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
highAvailabilityConfig: { highAvailabilityType: "AvailabilityZone" },
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
},
environment: "Prod",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_HA_AvZone.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("X00-RG", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E16ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 2L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 6L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 2L)
{
DatabaseType = SapDatabaseType.Hana,
})
{
HighAvailabilityType = SapHighAvailabilityType.AvailabilityZone,
CustomResourceNames = new ThreeTierFullResourceNames
{
CentralServer = new CentralServerFullResourceNames
{
VirtualMachines = {new VirtualMachineResourceNames
{
VmName = "ascsvm",
HostName = "ascshostName",
NetworkInterfaces = {new NetworkInterfaceResourceNames
{
NetworkInterfaceName = "ascsnic",
}},
OSDiskName = "ascsosdisk",
}, new VirtualMachineResourceNames
{
VmName = "ersvm",
HostName = "ershostName",
NetworkInterfaces = {new NetworkInterfaceResourceNames
{
NetworkInterfaceName = "ersnic",
}},
OSDiskName = "ersosdisk",
}},
LoadBalancer = new LoadBalancerResourceNames
{
LoadBalancerName = "ascslb",
FrontendIPConfigurationNames = { "ascsip0", "ersip0" },
BackendPoolNames = { "ascsBackendPool" },
HealthProbeNames = { "ascsHealthProbe", "ersHealthProbe" },
},
},
ApplicationServer = new ApplicationServerFullResourceNames
{
VirtualMachines = {new VirtualMachineResourceNames
{
VmName = "appvm0",
HostName = "apphostName0",
NetworkInterfaces = {new NetworkInterfaceResourceNames
{
NetworkInterfaceName = "appnic0",
}},
OSDiskName = "app0osdisk",
DataDiskNames =
{
["default"] = new string[]{"app0disk0"}
},
}, new VirtualMachineResourceNames
{
VmName = "appvm1",
HostName = "apphostName1",
NetworkInterfaces = {new NetworkInterfaceResourceNames
{
NetworkInterfaceName = "appnic1",
}},
OSDiskName = "app1osdisk",
DataDiskNames =
{
["default"] = new string[]{"app1disk0"}
},
}},
},
DatabaseServer = new DatabaseServerFullResourceNames
{
VirtualMachines = {new VirtualMachineResourceNames
{
VmName = "dbvmpr",
HostName = "dbprhostName",
NetworkInterfaces = {new NetworkInterfaceResourceNames
{
NetworkInterfaceName = "dbprnic",
}},
OSDiskName = "dbprosdisk",
DataDiskNames =
{
["hanaData"] = new string[]{"hanadatapr0", "hanadatapr1"},
["hanaLog"] = new string[]{"hanalogpr0", "hanalogpr1", "hanalogpr2"},
["hanaShared"] = new string[]{"hanasharedpr0", "hanasharedpr1"},
["usrSap"] = new string[]{"usrsappr0"}
},
}, new VirtualMachineResourceNames
{
VmName = "dbvmsr",
HostName = "dbsrhostName",
NetworkInterfaces = {new NetworkInterfaceResourceNames
{
NetworkInterfaceName = "dbsrnic",
}},
OSDiskName = "dbsrosdisk",
DataDiskNames =
{
["hanaData"] = new string[]{"hanadatasr0", "hanadatasr1"},
["hanaLog"] = new string[]{"hanalogsr0", "hanalogsr1", "hanalogsr2"},
["hanaShared"] = new string[]{"hanasharedsr0", "hanasharedsr1"},
["usrSap"] = new string[]{"usrsapsr0"}
},
}},
LoadBalancer = new LoadBalancerResourceNames
{
LoadBalancerName = "dblb",
FrontendIPConfigurationNames = { "dbip" },
BackendPoolNames = { "dbBackendPool" },
HealthProbeNames = { "dbHealthProbe" },
},
},
SharedStorage = new SharedStorageResourceNames
{
SharedStorageAccountName = "storageacc",
SharedStorageAccountPrivateEndPointName = "peForxNFS",
},
},
},
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilityZone"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"customResourceNames": {
"namingPatternType": "FullResourceName",
"centralServer": {
"virtualMachines": [
{
"vmName": "ascsvm",
"hostName": "ascshostName",
"networkInterfaces": [
{
"networkInterfaceName": "ascsnic"
}
],
"osDiskName": "ascsosdisk"
},
{
"vmName": "ersvm",
"hostName": "ershostName",
"networkInterfaces": [
{
"networkInterfaceName": "ersnic"
}
],
"osDiskName": "ersosdisk"
}
],
"loadBalancer": {
"loadBalancerName": "ascslb",
"frontendIpConfigurationNames": [
"ascsip0",
"ersip0"
],
"backendPoolNames": [
"ascsBackendPool"
],
"healthProbeNames": [
"ascsHealthProbe",
"ersHealthProbe"
]
}
},
"applicationServer": {
"virtualMachines": [
{
"vmName": "appvm0",
"hostName": "apphostName0",
"networkInterfaces": [
{
"networkInterfaceName": "appnic0"
}
],
"osDiskName": "app0osdisk",
"dataDiskNames": {
"default": [
"app0disk0"
]
}
},
{
"vmName": "appvm1",
"hostName": "apphostName1",
"networkInterfaces": [
{
"networkInterfaceName": "appnic1"
}
],
"osDiskName": "app1osdisk",
"dataDiskNames": {
"default": [
"app1disk0"
]
}
}
]
},
"databaseServer": {
"virtualMachines": [
{
"vmName": "dbvmpr",
"hostName": "dbprhostName",
"networkInterfaces": [
{
"networkInterfaceName": "dbprnic"
}
],
"osDiskName": "dbprosdisk",
"dataDiskNames": {
"hanaData": [
"hanadatapr0",
"hanadatapr1"
],
"hanaLog": [
"hanalogpr0",
"hanalogpr1",
"hanalogpr2"
],
"usrSap": [
"usrsappr0"
],
"hanaShared": [
"hanasharedpr0",
"hanasharedpr1"
]
}
},
{
"vmName": "dbvmsr",
"hostName": "dbsrhostName",
"networkInterfaces": [
{
"networkInterfaceName": "dbsrnic"
}
],
"osDiskName": "dbsrosdisk",
"dataDiskNames": {
"hanaData": [
"hanadatasr0",
"hanadatasr1"
],
"hanaLog": [
"hanalogsr0",
"hanalogsr1",
"hanalogsr2"
],
"usrSap": [
"usrsapsr0"
],
"hanaShared": [
"hanasharedsr0",
"hanasharedsr1"
]
}
}
],
"loadBalancer": {
"loadBalancerName": "dblb",
"frontendIpConfigurationNames": [
"dbip"
],
"backendPoolNames": [
"dbBackendPool"
],
"healthProbeNames": [
"dbHealthProbe"
]
}
},
"sharedStorage": {
"sharedStorageAccountName": "storageacc",
"sharedStorageAccountPrivateEndPointName": "peForxNFS"
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilityZone"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"customResourceNames": {
"namingPatternType": "FullResourceName",
"centralServer": {
"virtualMachines": [
{
"vmName": "ascsvm",
"hostName": "ascshostName",
"networkInterfaces": [
{
"networkInterfaceName": "ascsnic"
}
],
"osDiskName": "ascsosdisk"
},
{
"vmName": "ersvm",
"hostName": "ershostName",
"networkInterfaces": [
{
"networkInterfaceName": "ersnic"
}
],
"osDiskName": "ersosdisk"
}
],
"loadBalancer": {
"loadBalancerName": "ascslb",
"frontendIpConfigurationNames": [
"ascsip0",
"ersip0"
],
"backendPoolNames": [
"ascsBackendPool"
],
"healthProbeNames": [
"ascsHealthProbe",
"ersHealthProbe"
]
}
},
"applicationServer": {
"virtualMachines": [
{
"vmName": "appvm0",
"hostName": "apphostName0",
"networkInterfaces": [
{
"networkInterfaceName": "appnic0"
}
],
"osDiskName": "app0osdisk",
"dataDiskNames": {
"default": [
"app0disk0"
]
}
},
{
"vmName": "appvm1",
"hostName": "apphostName1",
"networkInterfaces": [
{
"networkInterfaceName": "appnic1"
}
],
"osDiskName": "app1osdisk",
"dataDiskNames": {
"default": [
"app1disk0"
]
}
}
]
},
"databaseServer": {
"virtualMachines": [
{
"vmName": "dbvmpr",
"hostName": "dbprhostName",
"networkInterfaces": [
{
"networkInterfaceName": "dbprnic"
}
],
"osDiskName": "dbprosdisk",
"dataDiskNames": {
"hanaData": [
"hanadatapr0",
"hanadatapr1"
],
"hanaLog": [
"hanalogpr0",
"hanalogpr1",
"hanalogpr2"
],
"usrSap": [
"usrsappr0"
],
"hanaShared": [
"hanasharedpr0",
"hanasharedpr1"
]
}
},
{
"vmName": "dbvmsr",
"hostName": "dbsrhostName",
"networkInterfaces": [
{
"networkInterfaceName": "dbsrnic"
}
],
"osDiskName": "dbsrosdisk",
"dataDiskNames": {
"hanaData": [
"hanadatasr0",
"hanadatasr1"
],
"hanaLog": [
"hanalogsr0",
"hanalogsr1",
"hanalogsr2"
],
"usrSap": [
"usrsapsr0"
],
"hanaShared": [
"hanasharedsr0",
"hanasharedsr1"
]
}
}
],
"loadBalancer": {
"loadBalancerName": "dblb",
"frontendIpConfigurationNames": [
"dbip"
],
"backendPoolNames": [
"dbBackendPool"
],
"healthProbeNames": [
"dbHealthProbe"
]
}
},
"sharedStorage": {
"sharedStorageAccountName": "storageacc",
"sharedStorageAccountPrivateEndPointName": "peForxNFS"
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure (with OS configuration) with custom resource names for Single Server System
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "SingleServer",
"appResourceGroup": "X00-RG",
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.NetworkConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SingleServerConfiguration;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_CustomFullResourceNames_SingleServer.json
*/
/**
* Sample code: Create Infrastructure (with OS configuration) with custom resource names for Single Server System.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void createInfrastructureWithOSConfigurationWithCustomResourceNamesForSingleServerSystem(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.NON_PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new SingleServerConfiguration().withAppResourceGroup("X00-RG")
.withNetworkConfiguration(new NetworkConfiguration().withIsSecondaryIpEnabled(true))
.withDatabaseType(SapDatabaseType.HANA)
.withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder"))))))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_custom_full_resource_names_single_server.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_SingleServer.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_SingleServer.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationWithCustomResourceNamesForSingleServerSystem() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer),
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
NetworkConfiguration: &armworkloads.NetworkConfiguration{
IsSecondaryIPEnabled: to.Ptr(true),
},
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer),
// CustomResourceNames: &armworkloads.SingleServerFullResourceNames{
// NamingPatternType: to.Ptr(armworkloads.NamingPatternTypeFullResourceName),
// VirtualMachine: &armworkloads.VirtualMachineResourceNames{
// DataDiskNames: map[string][]*string{
// "hanaData": []*string{
// to.Ptr("hanadata0"),
// to.Ptr("hanadata1")},
// "hanaLog": []*string{
// to.Ptr("hanalog0"),
// to.Ptr("hanalog1"),
// to.Ptr("hanalog2")},
// "hanaShared": []*string{
// to.Ptr("hanashared0"),
// to.Ptr("hanashared1")},
// "usrSap": []*string{
// to.Ptr("usrsap0")},
// },
// HostName: to.Ptr("sshostName"),
// NetworkInterfaces: []*armworkloads.NetworkInterfaceResourceNames{
// {
// NetworkInterfaceName: to.Ptr("ssnic"),
// }},
// OSDiskName: to.Ptr("ssosdisk"),
// VMName: to.Ptr("ssvm"),
// },
// },
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// NetworkConfiguration: &armworkloads.NetworkConfiguration{
// IsSecondaryIPEnabled: to.Ptr(true),
// },
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_SingleServer.json
*/
async function createInfrastructureWithOSConfigurationWithCustomResourceNamesForSingleServerSystem() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
databaseType: "HANA",
deploymentType: "SingleServer",
networkConfiguration: { isSecondaryIpEnabled: true },
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
},
environment: "NonProd",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_CustomFullResourceNames_SingleServer.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.NonProd, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new SingleServerConfiguration("X00-RG", new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}))
{
IsSecondaryIPEnabled = true,
DatabaseType = SapDatabaseType.Hana,
},
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "SingleServer",
"appResourceGroup": "X00-RG",
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"customResourceNames": {
"namingPatternType": "FullResourceName",
"virtualMachine": {
"vmName": "ssvm",
"hostName": "sshostName",
"networkInterfaces": [
{
"networkInterfaceName": "ssnic"
}
],
"osDiskName": "ssosdisk",
"dataDiskNames": {
"hanaData": [
"hanadata0",
"hanadata1"
],
"hanaLog": [
"hanalog0",
"hanalog1",
"hanalog2"
],
"usrSap": [
"usrsap0"
],
"hanaShared": [
"hanashared0",
"hanashared1"
]
}
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "SingleServer",
"appResourceGroup": "X00-RG",
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"customResourceNames": {
"namingPatternType": "FullResourceName",
"virtualMachine": {
"vmName": "ssvm",
"hostName": "sshostName",
"networkInterfaces": [
{
"networkInterfaceName": "ssnic"
}
],
"osDiskName": "ssosdisk",
"dataDiskNames": {
"hanaData": [
"hanadata0",
"hanadata1"
],
"hanaLog": [
"hanalog0",
"hanalog1",
"hanalog2"
],
"usrSap": [
"usrsap0"
],
"hanaShared": [
"hanashared0",
"hanashared1"
]
}
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure only for Distributed System
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Deployment",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 1
}
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DeploymentConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SshConfiguration;
import com.azure.resourcemanager.workloads.models.SshPublicKey;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_Distributed.json
*/
/**
* Sample code: Create Infrastructure only for Distributed System.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void
createInfrastructureOnlyForDistributedSystem(com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("X00-RG")
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E16ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSsh(new SshConfiguration().withPublicKeys(
Arrays.asList(new SshPublicKey().withKeyData("fakeTokenPlaceholder")))))))
.withInstanceCount(1L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSsh(new SshConfiguration().withPublicKeys(
Arrays.asList(new SshPublicKey().withKeyData("fakeTokenPlaceholder")))))))
.withInstanceCount(6L))
.withDatabaseServer(new DatabaseConfiguration().withDatabaseType(SapDatabaseType.HANA).withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSsh(new SshConfiguration().withPublicKeys(
Arrays.asList(new SshPublicKey().withKeyData("fakeTokenPlaceholder")))))))
.withInstanceCount(1L))))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_distributed.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForDistributedSystem() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](6),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSH: &armworkloads.SSHConfiguration{
PublicKeys: []*armworkloads.SSHPublicKey{
{
KeyData: to.Ptr("ssh-rsa public key"),
}},
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSH: &armworkloads.SSHConfiguration{
PublicKeys: []*armworkloads.SSHPublicKey{
{
KeyData: to.Ptr("ssh-rsa public key"),
}},
},
},
},
VMSize: to.Ptr("Standard_E16ds_v4"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSH: &armworkloads.SSHConfiguration{
PublicKeys: []*armworkloads.SSHPublicKey{
{
KeyData: to.Ptr("ssh-rsa public key"),
}},
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](6),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSH: &armworkloads.SSHConfiguration{
// PublicKeys: []*armworkloads.SSHPublicKey{
// {
// KeyData: to.Ptr("ssh-rsa public key"),
// }},
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSH: &armworkloads.SSHConfiguration{
// PublicKeys: []*armworkloads.SSHPublicKey{
// {
// KeyData: to.Ptr("ssh-rsa public key"),
// }},
// },
// },
// },
// VMSize: to.Ptr("Standard_E16ds_v4"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSH: &armworkloads.SSHConfiguration{
// PublicKeys: []*armworkloads.SSHPublicKey{
// {
// KeyData: to.Ptr("ssh-rsa public key"),
// }},
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed.json
*/
async function createInfrastructureOnlyForDistributedSystem() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "Deployment",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
applicationServer: {
instanceCount: 6,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
ssh: { publicKeys: [{ keyData: "ssh-rsa public key" }] },
},
},
vmSize: "Standard_E32ds_v4",
},
},
centralServer: {
instanceCount: 1,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
ssh: { publicKeys: [{ keyData: "ssh-rsa public key" }] },
},
},
vmSize: "Standard_E16ds_v4",
},
},
databaseServer: {
databaseType: "HANA",
instanceCount: 1,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
ssh: { publicKeys: [{ keyData: "ssh-rsa public key" }] },
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
},
},
environment: "Prod",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("X00-RG", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E16ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshPublicKeys = {new SapSshPublicKey
{
KeyData = "ssh-rsa public key",
}},
},
}), 1L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshPublicKeys = {new SapSshPublicKey
{
KeyData = "ssh-rsa public key",
}},
},
}), 6L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshPublicKeys = {new SapSshPublicKey
{
KeyData = "ssh-rsa public key",
}},
},
}), 1L)
{
DatabaseType = SapDatabaseType.Hana,
}),
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Deployment",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 1
}
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Deployment",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 1
}
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure only for HA System with Availability Set
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Deployment",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilitySet"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 5
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 2
}
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DeploymentConfiguration;
import com.azure.resourcemanager.workloads.models.HighAvailabilityConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapHighAvailabilityType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SshConfiguration;
import com.azure.resourcemanager.workloads.models.SshPublicKey;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_HA_AvSet.json
*/
/**
* Sample code: Create Infrastructure only for HA System with Availability Set.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void createInfrastructureOnlyForHASystemWithAvailabilitySet(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("X00-RG")
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E16ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSsh(new SshConfiguration().withPublicKeys(
Arrays.asList(new SshPublicKey().withKeyData("fakeTokenPlaceholder")))))))
.withInstanceCount(2L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSsh(new SshConfiguration().withPublicKeys(
Arrays.asList(new SshPublicKey().withKeyData("fakeTokenPlaceholder")))))))
.withInstanceCount(5L))
.withDatabaseServer(new DatabaseConfiguration().withDatabaseType(SapDatabaseType.HANA).withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSsh(new SshConfiguration().withPublicKeys(
Arrays.asList(new SshPublicKey().withKeyData("fakeTokenPlaceholder")))))))
.withInstanceCount(2L))
.withHighAvailabilityConfig(new HighAvailabilityConfiguration()
.withHighAvailabilityType(SapHighAvailabilityType.AVAILABILITY_SET))))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_ha_av_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 = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvSet.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvSet.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaSystemWithAvailabilitySet() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](5),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSH: &armworkloads.SSHConfiguration{
PublicKeys: []*armworkloads.SSHPublicKey{
{
KeyData: to.Ptr("ssh-rsa public key"),
}},
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSH: &armworkloads.SSHConfiguration{
PublicKeys: []*armworkloads.SSHPublicKey{
{
KeyData: to.Ptr("ssh-rsa public key"),
}},
},
},
},
VMSize: to.Ptr("Standard_E16ds_v4"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSH: &armworkloads.SSHConfiguration{
PublicKeys: []*armworkloads.SSHPublicKey{
{
KeyData: to.Ptr("ssh-rsa public key"),
}},
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet),
},
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](5),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSH: &armworkloads.SSHConfiguration{
// PublicKeys: []*armworkloads.SSHPublicKey{
// {
// KeyData: to.Ptr("ssh-rsa public key"),
// }},
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSH: &armworkloads.SSHConfiguration{
// PublicKeys: []*armworkloads.SSHPublicKey{
// {
// KeyData: to.Ptr("ssh-rsa public key"),
// }},
// },
// },
// },
// VMSize: to.Ptr("Standard_E16ds_v4"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSH: &armworkloads.SSHConfiguration{
// PublicKeys: []*armworkloads.SSHPublicKey{
// {
// KeyData: to.Ptr("ssh-rsa public key"),
// }},
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
// HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet),
// },
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvSet.json
*/
async function createInfrastructureOnlyForHaSystemWithAvailabilitySet() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "Deployment",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
applicationServer: {
instanceCount: 5,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
ssh: { publicKeys: [{ keyData: "ssh-rsa public key" }] },
},
},
vmSize: "Standard_E32ds_v4",
},
},
centralServer: {
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
ssh: { publicKeys: [{ keyData: "ssh-rsa public key" }] },
},
},
vmSize: "Standard_E16ds_v4",
},
},
databaseServer: {
databaseType: "HANA",
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
ssh: { publicKeys: [{ keyData: "ssh-rsa public key" }] },
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
highAvailabilityConfig: { highAvailabilityType: "AvailabilitySet" },
},
},
environment: "Prod",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvSet.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("X00-RG", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E16ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshPublicKeys = {new SapSshPublicKey
{
KeyData = "ssh-rsa public key",
}},
},
}), 2L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshPublicKeys = {new SapSshPublicKey
{
KeyData = "ssh-rsa public key",
}},
},
}), 5L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshPublicKeys = {new SapSshPublicKey
{
KeyData = "ssh-rsa public key",
}},
},
}), 2L)
{
DatabaseType = SapDatabaseType.Hana,
})
{
HighAvailabilityType = SapHighAvailabilityType.AvailabilitySet,
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Deployment",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilitySet"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 5
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 2
}
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Deployment",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilitySet"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 5
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 2
}
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure only for HA System with Availability Zone
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Deployment",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilityZone"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 2
}
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DeploymentConfiguration;
import com.azure.resourcemanager.workloads.models.HighAvailabilityConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapHighAvailabilityType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SshConfiguration;
import com.azure.resourcemanager.workloads.models.SshPublicKey;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_HA_AvZone.json
*/
/**
* Sample code: Create Infrastructure only for HA System with Availability Zone.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void createInfrastructureOnlyForHASystemWithAvailabilityZone(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("X00-RG")
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E16ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSsh(new SshConfiguration().withPublicKeys(
Arrays.asList(new SshPublicKey().withKeyData("fakeTokenPlaceholder")))))))
.withInstanceCount(2L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSsh(new SshConfiguration().withPublicKeys(
Arrays.asList(new SshPublicKey().withKeyData("fakeTokenPlaceholder")))))))
.withInstanceCount(6L))
.withDatabaseServer(new DatabaseConfiguration().withDatabaseType(SapDatabaseType.HANA).withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSsh(new SshConfiguration().withPublicKeys(
Arrays.asList(new SshPublicKey().withKeyData("fakeTokenPlaceholder")))))))
.withInstanceCount(2L))
.withHighAvailabilityConfig(new HighAvailabilityConfiguration()
.withHighAvailabilityType(SapHighAvailabilityType.AVAILABILITY_ZONE))))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_ha_av_zone.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvZone.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvZone.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForHaSystemWithAvailabilityZone() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](6),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSH: &armworkloads.SSHConfiguration{
PublicKeys: []*armworkloads.SSHPublicKey{
{
KeyData: to.Ptr("ssh-rsa public key"),
}},
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSH: &armworkloads.SSHConfiguration{
PublicKeys: []*armworkloads.SSHPublicKey{
{
KeyData: to.Ptr("ssh-rsa public key"),
}},
},
},
},
VMSize: to.Ptr("Standard_E16ds_v4"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSH: &armworkloads.SSHConfiguration{
PublicKeys: []*armworkloads.SSHPublicKey{
{
KeyData: to.Ptr("ssh-rsa public key"),
}},
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone),
},
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](6),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSH: &armworkloads.SSHConfiguration{
// PublicKeys: []*armworkloads.SSHPublicKey{
// {
// KeyData: to.Ptr("ssh-rsa public key"),
// }},
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSH: &armworkloads.SSHConfiguration{
// PublicKeys: []*armworkloads.SSHPublicKey{
// {
// KeyData: to.Ptr("ssh-rsa public key"),
// }},
// },
// },
// },
// VMSize: to.Ptr("Standard_E16ds_v4"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSH: &armworkloads.SSHConfiguration{
// PublicKeys: []*armworkloads.SSHPublicKey{
// {
// KeyData: to.Ptr("ssh-rsa public key"),
// }},
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
// HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone),
// },
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvZone.json
*/
async function createInfrastructureOnlyForHaSystemWithAvailabilityZone() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "Deployment",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
applicationServer: {
instanceCount: 6,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
ssh: { publicKeys: [{ keyData: "ssh-rsa public key" }] },
},
},
vmSize: "Standard_E32ds_v4",
},
},
centralServer: {
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
ssh: { publicKeys: [{ keyData: "ssh-rsa public key" }] },
},
},
vmSize: "Standard_E16ds_v4",
},
},
databaseServer: {
databaseType: "HANA",
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
ssh: { publicKeys: [{ keyData: "ssh-rsa public key" }] },
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
highAvailabilityConfig: { highAvailabilityType: "AvailabilityZone" },
},
},
environment: "Prod",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_HA_AvZone.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("X00-RG", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E16ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshPublicKeys = {new SapSshPublicKey
{
KeyData = "ssh-rsa public key",
}},
},
}), 2L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshPublicKeys = {new SapSshPublicKey
{
KeyData = "ssh-rsa public key",
}},
},
}), 6L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshPublicKeys = {new SapSshPublicKey
{
KeyData = "ssh-rsa public key",
}},
},
}), 2L)
{
DatabaseType = SapDatabaseType.Hana,
})
{
HighAvailabilityType = SapHighAvailabilityType.AvailabilityZone,
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Deployment",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilityZone"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 2
}
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Deployment",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilityZone"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
},
"instanceCount": 2
}
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure only for Single Server System
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Deployment",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "SingleServer",
"appResourceGroup": "X00-RG",
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
}
}
}
}
}
import com.azure.resourcemanager.workloads.models.DeploymentConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.NetworkConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SingleServerConfiguration;
import com.azure.resourcemanager.workloads.models.SshConfiguration;
import com.azure.resourcemanager.workloads.models.SshPublicKey;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_SingleServer.json
*/
/**
* Sample code: Create Infrastructure only for Single Server System.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void
createInfrastructureOnlyForSingleServerSystem(com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.NON_PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new SingleServerConfiguration().withAppResourceGroup("X00-RG")
.withNetworkConfiguration(new NetworkConfiguration().withIsSecondaryIpEnabled(true))
.withDatabaseType(SapDatabaseType.HANA)
.withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSsh(new SshConfiguration().withPublicKeys(
Arrays.asList(new SshPublicKey().withKeyData("fakeTokenPlaceholder")))))))))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_single_server.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_SingleServer.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_SingleServer.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureOnlyForSingleServerSystem() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer),
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
NetworkConfiguration: &armworkloads.NetworkConfiguration{
IsSecondaryIPEnabled: to.Ptr(true),
},
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSH: &armworkloads.SSHConfiguration{
PublicKeys: []*armworkloads.SSHPublicKey{
{
KeyData: to.Ptr("ssh-rsa public key"),
}},
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeployment),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer),
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSH: &armworkloads.SSHConfiguration{
// PublicKeys: []*armworkloads.SSHPublicKey{
// {
// KeyData: to.Ptr("ssh-rsa public key"),
// }},
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_SingleServer.json
*/
async function createInfrastructureOnlyForSingleServerSystem() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "Deployment",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
databaseType: "HANA",
deploymentType: "SingleServer",
networkConfiguration: { isSecondaryIpEnabled: true },
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
ssh: { publicKeys: [{ keyData: "ssh-rsa public key" }] },
},
},
vmSize: "Standard_E32ds_v4",
},
},
},
environment: "NonProd",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_SingleServer.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.NonProd, SapProductType.S4Hana, new DeploymentConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new SingleServerConfiguration("X00-RG", new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshPublicKeys = {new SapSshPublicKey
{
KeyData = "ssh-rsa public key",
}},
},
}))
{
IsSecondaryIPEnabled = true,
DatabaseType = SapDatabaseType.Hana,
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Deployment",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "SingleServer",
"appResourceGroup": "X00-RG",
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
}
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Deployment",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "SingleServer",
"appResourceGroup": "X00-RG",
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa public key"
}
]
}
}
}
}
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure with a new SAP Transport Directory Fileshare
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"storageConfiguration": {
"transportFileShareConfiguration": {
"configurationType": "CreateAndMount",
"resourceGroup": "rgName",
"storageAccountName": "storageName"
}
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 1
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.CreateAndMountFileShareConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.StorageConfiguration;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_Distributed_CreateTransport.json
*/
/**
* Sample code: Create Infrastructure with a new SAP Transport Directory Fileshare.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void createInfrastructureWithANewSAPTransportDirectoryFileshare(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("X00-RG")
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize(
"Standard_E16ds_v4").withImageReference(
new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP").withSku(
"84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}").withOsConfiguration(
new LinuxConfiguration().withDisablePasswordAuthentication(true).withSshKeyPair(
new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(1L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(6L))
.withDatabaseServer(new DatabaseConfiguration().withDatabaseType(SapDatabaseType.HANA).withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(1L))
.withStorageConfiguration(new StorageConfiguration()
.withTransportFileShareConfiguration(new CreateAndMountFileShareConfiguration()
.withResourceGroup("rgName").withStorageAccountName("storageName"))))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_distributed_create_transport.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_CreateTransport.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_CreateTransport.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithANewSapTransportDirectoryFileshare() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](6),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E16ds_v4"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
StorageConfiguration: &armworkloads.StorageConfiguration{
TransportFileShareConfiguration: &armworkloads.CreateAndMountFileShareConfiguration{
ConfigurationType: to.Ptr(armworkloads.ConfigurationTypeCreateAndMount),
ResourceGroup: to.Ptr("rgName"),
StorageAccountName: to.Ptr("storageName"),
},
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](6),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E16ds_v4"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// StorageConfiguration: &armworkloads.StorageConfiguration{
// TransportFileShareConfiguration: &armworkloads.CreateAndMountFileShareConfiguration{
// ConfigurationType: to.Ptr(armworkloads.ConfigurationTypeCreateAndMount),
// ResourceGroup: to.Ptr("rgName"),
// StorageAccountName: to.Ptr("storageName"),
// },
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_CreateTransport.json
*/
async function createInfrastructureWithANewSapTransportDirectoryFileshare() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
applicationServer: {
instanceCount: 6,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
centralServer: {
instanceCount: 1,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E16ds_v4",
},
},
databaseServer: {
databaseType: "HANA",
instanceCount: 1,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
storageConfiguration: {
transportFileShareConfiguration: {
configurationType: "CreateAndMount",
resourceGroup: "rgName",
storageAccountName: "storageName",
},
},
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
},
environment: "Prod",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_CreateTransport.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("X00-RG", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E16ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 1L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 6L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 1L)
{
DatabaseType = SapDatabaseType.Hana,
})
{
StorageTransportFileShareConfiguration = new CreateAndMountFileShareConfiguration
{
ResourceGroup = "rgName",
StorageAccountName = "storageName",
},
},
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"storageConfiguration": {
"transportFileShareConfiguration": {
"configurationType": "CreateAndMount",
"resourceGroup": "rgName",
"storageAccountName": "storageName"
}
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"storageConfiguration": {
"transportFileShareConfiguration": {
"configurationType": "CreateAndMount",
"resourceGroup": "rgName",
"storageAccountName": "storageName"
}
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure with an existing SAP Transport Directory Fileshare
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"storageConfiguration": {
"transportFileShareConfiguration": {
"configurationType": "Mount",
"id": "/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint",
"privateEndpointId": "/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"
}
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 1
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.MountFileShareConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.StorageConfiguration;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_Distributed_MountTransport.json
*/
/**
* Sample code: Create Infrastructure with an existing SAP Transport Directory Fileshare.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void createInfrastructureWithAnExistingSAPTransportDirectoryFileshare(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("X00-RG")
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize(
"Standard_E16ds_v4").withImageReference(
new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP").withSku(
"84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}").withOsConfiguration(
new LinuxConfiguration().withDisablePasswordAuthentication(true).withSshKeyPair(
new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(1L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(6L))
.withDatabaseServer(new DatabaseConfiguration().withDatabaseType(SapDatabaseType.HANA).withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(1L))
.withStorageConfiguration(new StorageConfiguration()
.withTransportFileShareConfiguration(new MountFileShareConfiguration().withId(
"/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint")
.withPrivateEndpointId(
"/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"))))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_distributed_mount_transport.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_MountTransport.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_MountTransport.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithAnExistingSapTransportDirectoryFileshare() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](6),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E16ds_v4"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
StorageConfiguration: &armworkloads.StorageConfiguration{
TransportFileShareConfiguration: &armworkloads.MountFileShareConfiguration{
ConfigurationType: to.Ptr(armworkloads.ConfigurationTypeMount),
ID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"),
PrivateEndpointID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"),
},
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](6),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E16ds_v4"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// StorageConfiguration: &armworkloads.StorageConfiguration{
// TransportFileShareConfiguration: &armworkloads.MountFileShareConfiguration{
// ConfigurationType: to.Ptr(armworkloads.ConfigurationTypeMount),
// ID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"),
// PrivateEndpointID: to.Ptr("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"),
// },
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_MountTransport.json
*/
async function createInfrastructureWithAnExistingSapTransportDirectoryFileshare() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
applicationServer: {
instanceCount: 6,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
centralServer: {
instanceCount: 1,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E16ds_v4",
},
},
databaseServer: {
databaseType: "HANA",
instanceCount: 1,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
storageConfiguration: {
transportFileShareConfiguration: {
configurationType: "Mount",
id: "/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint",
privateEndpointId:
"/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint",
},
},
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
},
environment: "Prod",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_MountTransport.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("X00-RG", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E16ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 1L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 6L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 1L)
{
DatabaseType = SapDatabaseType.Hana,
})
{
StorageTransportFileShareConfiguration = new MountFileShareConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"), new ResourceIdentifier("/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint")),
},
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"storageConfiguration": {
"transportFileShareConfiguration": {
"configurationType": "Mount",
"id": "/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint",
"privateEndpointId": "/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"
}
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"storageConfiguration": {
"transportFileShareConfiguration": {
"configurationType": "Mount",
"id": "/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint",
"privateEndpointId": "/subscriptions/49d64d54-e888-4c46-a868-1936802b762c/resourceGroups/testrg/providers/Microsoft.Network/privateEndpoints/endpoint"
}
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure with Disk and OS configuration for Distributed System (Recommended)
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"diskConfiguration": {
"diskVolumeConfigurations": {
"hana/data": {
"count": 4,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/log": {
"count": 3,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/shared": {
"count": 1,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"usr/sap": {
"count": 1,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"backup": {
"count": 2,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"os": {
"count": 1,
"sizeGB": 64,
"sku": {
"name": "StandardSSD_LRS"
}
}
}
},
"instanceCount": 1
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.DiskConfiguration;
import com.azure.resourcemanager.workloads.models.DiskSku;
import com.azure.resourcemanager.workloads.models.DiskSkuName;
import com.azure.resourcemanager.workloads.models.DiskVolumeConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_DiskDetails_Distributed.json
*/
/**
* Sample code: Create Infrastructure with Disk and OS configuration for Distributed System (Recommended).
*
* @param manager Entry point to WorkloadsManager.
*/
public static void createInfrastructureWithDiskAndOSConfigurationForDistributedSystemRecommended(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("X00-RG")
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E16ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(1L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(6L))
.withDatabaseServer(new DatabaseConfiguration().withDatabaseType(SapDatabaseType.HANA).withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(
1L)
.withDiskConfiguration(new DiskConfiguration().withDiskVolumeConfigurations(mapOf("backup",
new DiskVolumeConfiguration().withCount(2L).withSizeGB(256L)
.withSku(new DiskSku().withName(DiskSkuName.STANDARD_SSD_LRS)),
"hana/data",
new DiskVolumeConfiguration().withCount(4L).withSizeGB(128L)
.withSku(new DiskSku().withName(DiskSkuName.PREMIUM_LRS)),
"hana/log",
new DiskVolumeConfiguration().withCount(3L).withSizeGB(128L)
.withSku(new DiskSku().withName(DiskSkuName.PREMIUM_LRS)),
"hana/shared",
new DiskVolumeConfiguration().withCount(1L).withSizeGB(256L)
.withSku(new DiskSku().withName(DiskSkuName.STANDARD_SSD_LRS)),
"os",
new DiskVolumeConfiguration().withCount(1L).withSizeGB(64L)
.withSku(new DiskSku().withName(DiskSkuName.STANDARD_SSD_LRS)),
"usr/sap",
new DiskVolumeConfiguration().withCount(1L).withSizeGB(128L)
.withSku(new DiskSku().withName(DiskSkuName.PREMIUM_LRS)))))))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_disk_details_distributed.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_Distributed.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_Distributed.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOsConfigurationForDistributedSystemRecommended() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](6),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E16ds_v4"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
DiskConfiguration: &armworkloads.DiskConfiguration{
DiskVolumeConfigurations: map[string]*armworkloads.DiskVolumeConfiguration{
"backup": {
Count: to.Ptr[int64](2),
SizeGB: to.Ptr[int64](256),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
},
},
"hana/data": {
Count: to.Ptr[int64](4),
SizeGB: to.Ptr[int64](128),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
},
},
"hana/log": {
Count: to.Ptr[int64](3),
SizeGB: to.Ptr[int64](128),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
},
},
"hana/shared": {
Count: to.Ptr[int64](1),
SizeGB: to.Ptr[int64](256),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
},
},
"os": {
Count: to.Ptr[int64](1),
SizeGB: to.Ptr[int64](64),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
},
},
"usr/sap": {
Count: to.Ptr[int64](1),
SizeGB: to.Ptr[int64](128),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
},
},
},
},
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](6),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E16ds_v4"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// DiskConfiguration: &armworkloads.DiskConfiguration{
// DiskVolumeConfigurations: map[string]*armworkloads.DiskVolumeConfiguration{
// "backup": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](2),
// SizeGB: to.Ptr[int64](256),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
// },
// },
// "hana/data": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](4),
// SizeGB: to.Ptr[int64](128),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
// },
// },
// "hana/log": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](3),
// SizeGB: to.Ptr[int64](128),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
// },
// },
// "hana/shared": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](1),
// SizeGB: to.Ptr[int64](256),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
// },
// },
// "os": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](1),
// SizeGB: to.Ptr[int64](64),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
// },
// },
// "usr/sap": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](1),
// SizeGB: to.Ptr[int64](128),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
// },
// },
// },
// },
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_Distributed.json
*/
async function createInfrastructureWithDiskAndOSConfigurationForDistributedSystemRecommended() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
applicationServer: {
instanceCount: 6,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
centralServer: {
instanceCount: 1,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E16ds_v4",
},
},
databaseServer: {
databaseType: "HANA",
diskConfiguration: {
diskVolumeConfigurations: {
backup: {
count: 2,
sizeGB: 256,
sku: { name: "StandardSSD_LRS" },
},
"hana/data": {
count: 4,
sizeGB: 128,
sku: { name: "Premium_LRS" },
},
"hana/log": {
count: 3,
sizeGB: 128,
sku: { name: "Premium_LRS" },
},
"hana/shared": {
count: 1,
sizeGB: 256,
sku: { name: "StandardSSD_LRS" },
},
os: { count: 1, sizeGB: 64, sku: { name: "StandardSSD_LRS" } },
"usr/sap": { count: 1, sizeGB: 128, sku: { name: "Premium_LRS" } },
},
},
instanceCount: 1,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
},
environment: "Prod",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_Distributed.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("X00-RG", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E16ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 1L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 6L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 1L)
{
DatabaseType = SapDatabaseType.Hana,
DiskVolumeConfigurations =
{
["backup"] = new DiskVolumeConfiguration
{
Count = 2L,
SizeInGB = 256L,
SkuName = DiskDetailsDiskSkuName.StandardSsdLrs,
},
["hana/data"] = new DiskVolumeConfiguration
{
Count = 4L,
SizeInGB = 128L,
SkuName = DiskDetailsDiskSkuName.PremiumLrs,
},
["hana/log"] = new DiskVolumeConfiguration
{
Count = 3L,
SizeInGB = 128L,
SkuName = DiskDetailsDiskSkuName.PremiumLrs,
},
["hana/shared"] = new DiskVolumeConfiguration
{
Count = 1L,
SizeInGB = 256L,
SkuName = DiskDetailsDiskSkuName.StandardSsdLrs,
},
["os"] = new DiskVolumeConfiguration
{
Count = 1L,
SizeInGB = 64L,
SkuName = DiskDetailsDiskSkuName.StandardSsdLrs,
},
["usr/sap"] = new DiskVolumeConfiguration
{
Count = 1L,
SizeInGB = 128L,
SkuName = DiskDetailsDiskSkuName.PremiumLrs,
}
},
}),
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"diskConfiguration": {
"diskVolumeConfigurations": {
"hana/data": {
"count": 4,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/log": {
"count": 3,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/shared": {
"count": 1,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"usr/sap": {
"count": 1,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"backup": {
"count": 2,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"os": {
"count": 1,
"sizeGB": 64,
"sku": {
"name": "StandardSSD_LRS"
}
}
}
},
"instanceCount": 1
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"diskConfiguration": {
"diskVolumeConfigurations": {
"hana/data": {
"count": 4,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/log": {
"count": 3,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/shared": {
"count": 1,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"usr/sap": {
"count": 1,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"backup": {
"count": 2,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"os": {
"count": 1,
"sizeGB": 64,
"sku": {
"name": "StandardSSD_LRS"
}
}
}
},
"instanceCount": 1
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure with Disk and OS configuration for HA System with Availability Set (Recommended)
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilitySet"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"diskConfiguration": {
"diskVolumeConfigurations": {
"hana/data": {
"count": 4,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/log": {
"count": 3,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/shared": {
"count": 1,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"usr/sap": {
"count": 1,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"backup": {
"count": 2,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"os": {
"count": 1,
"sizeGB": 64,
"sku": {
"name": "StandardSSD_LRS"
}
}
}
},
"instanceCount": 2
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.DiskConfiguration;
import com.azure.resourcemanager.workloads.models.DiskSku;
import com.azure.resourcemanager.workloads.models.DiskSkuName;
import com.azure.resourcemanager.workloads.models.DiskVolumeConfiguration;
import com.azure.resourcemanager.workloads.models.HighAvailabilityConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapHighAvailabilityType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_DiskDetails_HA_AvSet.json
*/
/**
* Sample code: Create Infrastructure with Disk and OS configuration for HA System with Availability Set
* (Recommended).
*
* @param manager Entry point to WorkloadsManager.
*/
public static void createInfrastructureWithDiskAndOSConfigurationForHASystemWithAvailabilitySetRecommended(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("X00-RG")
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E16ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(2L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(6L))
.withDatabaseServer(new DatabaseConfiguration().withDatabaseType(SapDatabaseType.HANA).withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(
2L)
.withDiskConfiguration(new DiskConfiguration().withDiskVolumeConfigurations(mapOf("backup",
new DiskVolumeConfiguration().withCount(2L).withSizeGB(256L)
.withSku(new DiskSku().withName(DiskSkuName.STANDARD_SSD_LRS)),
"hana/data",
new DiskVolumeConfiguration().withCount(4L).withSizeGB(128L)
.withSku(new DiskSku().withName(DiskSkuName.PREMIUM_LRS)),
"hana/log",
new DiskVolumeConfiguration().withCount(3L).withSizeGB(128L)
.withSku(new DiskSku().withName(DiskSkuName.PREMIUM_LRS)),
"hana/shared",
new DiskVolumeConfiguration().withCount(1L).withSizeGB(256L)
.withSku(new DiskSku().withName(DiskSkuName.STANDARD_SSD_LRS)),
"os",
new DiskVolumeConfiguration().withCount(1L).withSizeGB(64L)
.withSku(new DiskSku().withName(DiskSkuName.STANDARD_SSD_LRS)),
"usr/sap",
new DiskVolumeConfiguration().withCount(1L).withSizeGB(128L)
.withSku(new DiskSku().withName(DiskSkuName.PREMIUM_LRS))))))
.withHighAvailabilityConfig(new HighAvailabilityConfiguration()
.withHighAvailabilityType(SapHighAvailabilityType.AVAILABILITY_SET)))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_disk_details_ha_av_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 = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvSet.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvSet.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOsConfigurationForHaSystemWithAvailabilitySetRecommended() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](6),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E16ds_v4"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
DiskConfiguration: &armworkloads.DiskConfiguration{
DiskVolumeConfigurations: map[string]*armworkloads.DiskVolumeConfiguration{
"backup": {
Count: to.Ptr[int64](2),
SizeGB: to.Ptr[int64](256),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
},
},
"hana/data": {
Count: to.Ptr[int64](4),
SizeGB: to.Ptr[int64](128),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
},
},
"hana/log": {
Count: to.Ptr[int64](3),
SizeGB: to.Ptr[int64](128),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
},
},
"hana/shared": {
Count: to.Ptr[int64](1),
SizeGB: to.Ptr[int64](256),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
},
},
"os": {
Count: to.Ptr[int64](1),
SizeGB: to.Ptr[int64](64),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
},
},
"usr/sap": {
Count: to.Ptr[int64](1),
SizeGB: to.Ptr[int64](128),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
},
},
},
},
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet),
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](6),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E16ds_v4"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// DiskConfiguration: &armworkloads.DiskConfiguration{
// DiskVolumeConfigurations: map[string]*armworkloads.DiskVolumeConfiguration{
// "backup": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](2),
// SizeGB: to.Ptr[int64](256),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
// },
// },
// "hana/data": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](4),
// SizeGB: to.Ptr[int64](128),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
// },
// },
// "hana/log": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](3),
// SizeGB: to.Ptr[int64](128),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
// },
// },
// "hana/shared": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](1),
// SizeGB: to.Ptr[int64](256),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
// },
// },
// "os": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](1),
// SizeGB: to.Ptr[int64](64),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
// },
// },
// "usr/sap": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](1),
// SizeGB: to.Ptr[int64](128),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
// },
// },
// },
// },
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
// HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet),
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvSet.json
*/
async function createInfrastructureWithDiskAndOSConfigurationForHaSystemWithAvailabilitySetRecommended() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
applicationServer: {
instanceCount: 6,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
centralServer: {
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E16ds_v4",
},
},
databaseServer: {
databaseType: "HANA",
diskConfiguration: {
diskVolumeConfigurations: {
backup: {
count: 2,
sizeGB: 256,
sku: { name: "StandardSSD_LRS" },
},
"hana/data": {
count: 4,
sizeGB: 128,
sku: { name: "Premium_LRS" },
},
"hana/log": {
count: 3,
sizeGB: 128,
sku: { name: "Premium_LRS" },
},
"hana/shared": {
count: 1,
sizeGB: 256,
sku: { name: "StandardSSD_LRS" },
},
os: { count: 1, sizeGB: 64, sku: { name: "StandardSSD_LRS" } },
"usr/sap": { count: 1, sizeGB: 128, sku: { name: "Premium_LRS" } },
},
},
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
highAvailabilityConfig: { highAvailabilityType: "AvailabilitySet" },
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
},
environment: "Prod",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvSet.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("X00-RG", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E16ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 2L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 6L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 2L)
{
DatabaseType = SapDatabaseType.Hana,
DiskVolumeConfigurations =
{
["backup"] = new DiskVolumeConfiguration
{
Count = 2L,
SizeInGB = 256L,
SkuName = DiskDetailsDiskSkuName.StandardSsdLrs,
},
["hana/data"] = new DiskVolumeConfiguration
{
Count = 4L,
SizeInGB = 128L,
SkuName = DiskDetailsDiskSkuName.PremiumLrs,
},
["hana/log"] = new DiskVolumeConfiguration
{
Count = 3L,
SizeInGB = 128L,
SkuName = DiskDetailsDiskSkuName.PremiumLrs,
},
["hana/shared"] = new DiskVolumeConfiguration
{
Count = 1L,
SizeInGB = 256L,
SkuName = DiskDetailsDiskSkuName.StandardSsdLrs,
},
["os"] = new DiskVolumeConfiguration
{
Count = 1L,
SizeInGB = 64L,
SkuName = DiskDetailsDiskSkuName.StandardSsdLrs,
},
["usr/sap"] = new DiskVolumeConfiguration
{
Count = 1L,
SizeInGB = 128L,
SkuName = DiskDetailsDiskSkuName.PremiumLrs,
}
},
})
{
HighAvailabilityType = SapHighAvailabilityType.AvailabilitySet,
},
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilitySet"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"diskConfiguration": {
"diskVolumeConfigurations": {
"hana/data": {
"count": 4,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/log": {
"count": 3,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/shared": {
"count": 1,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"usr/sap": {
"count": 1,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"backup": {
"count": 2,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"os": {
"count": 1,
"sizeGB": 64,
"sku": {
"name": "StandardSSD_LRS"
}
}
}
},
"instanceCount": 2
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilitySet"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"diskConfiguration": {
"diskVolumeConfigurations": {
"hana/data": {
"count": 4,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/log": {
"count": 3,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/shared": {
"count": 1,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"usr/sap": {
"count": 1,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"backup": {
"count": 2,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"os": {
"count": 1,
"sizeGB": 64,
"sku": {
"name": "StandardSSD_LRS"
}
}
}
},
"instanceCount": 2
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure with Disk and OS configuration for HA System with Availability Zone (Recommended)
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilityZone"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"diskConfiguration": {
"diskVolumeConfigurations": {
"hana/data": {
"count": 4,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/log": {
"count": 3,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/shared": {
"count": 1,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"usr/sap": {
"count": 1,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"backup": {
"count": 2,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"os": {
"count": 1,
"sizeGB": 64,
"sku": {
"name": "StandardSSD_LRS"
}
}
}
},
"instanceCount": 2
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.DiskConfiguration;
import com.azure.resourcemanager.workloads.models.DiskSku;
import com.azure.resourcemanager.workloads.models.DiskSkuName;
import com.azure.resourcemanager.workloads.models.DiskVolumeConfiguration;
import com.azure.resourcemanager.workloads.models.HighAvailabilityConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapHighAvailabilityType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_DiskDetails_HA_AvZone.json
*/
/**
* Sample code: Create Infrastructure with Disk and OS configuration for HA System with Availability Zone
* (Recommended).
*
* @param manager Entry point to WorkloadsManager.
*/
public static void createInfrastructureWithDiskAndOSConfigurationForHASystemWithAvailabilityZoneRecommended(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("X00-RG")
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E16ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(2L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(6L))
.withDatabaseServer(new DatabaseConfiguration().withDatabaseType(SapDatabaseType.HANA).withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(
2L)
.withDiskConfiguration(new DiskConfiguration().withDiskVolumeConfigurations(mapOf("backup",
new DiskVolumeConfiguration().withCount(2L).withSizeGB(256L)
.withSku(new DiskSku().withName(DiskSkuName.STANDARD_SSD_LRS)),
"hana/data",
new DiskVolumeConfiguration().withCount(4L).withSizeGB(128L)
.withSku(new DiskSku().withName(DiskSkuName.PREMIUM_LRS)),
"hana/log",
new DiskVolumeConfiguration().withCount(3L).withSizeGB(128L)
.withSku(new DiskSku().withName(DiskSkuName.PREMIUM_LRS)),
"hana/shared",
new DiskVolumeConfiguration().withCount(1L).withSizeGB(256L)
.withSku(new DiskSku().withName(DiskSkuName.STANDARD_SSD_LRS)),
"os",
new DiskVolumeConfiguration().withCount(1L).withSizeGB(64L)
.withSku(new DiskSku().withName(DiskSkuName.STANDARD_SSD_LRS)),
"usr/sap",
new DiskVolumeConfiguration().withCount(1L).withSizeGB(128L)
.withSku(new DiskSku().withName(DiskSkuName.PREMIUM_LRS))))))
.withHighAvailabilityConfig(new HighAvailabilityConfiguration()
.withHighAvailabilityType(SapHighAvailabilityType.AVAILABILITY_ZONE)))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_disk_details_ha_av_zone.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvZone.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvZone.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOsConfigurationForHaSystemWithAvailabilityZoneRecommended() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](6),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E16ds_v4"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
DiskConfiguration: &armworkloads.DiskConfiguration{
DiskVolumeConfigurations: map[string]*armworkloads.DiskVolumeConfiguration{
"backup": {
Count: to.Ptr[int64](2),
SizeGB: to.Ptr[int64](256),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
},
},
"hana/data": {
Count: to.Ptr[int64](4),
SizeGB: to.Ptr[int64](128),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
},
},
"hana/log": {
Count: to.Ptr[int64](3),
SizeGB: to.Ptr[int64](128),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
},
},
"hana/shared": {
Count: to.Ptr[int64](1),
SizeGB: to.Ptr[int64](256),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
},
},
"os": {
Count: to.Ptr[int64](1),
SizeGB: to.Ptr[int64](64),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
},
},
"usr/sap": {
Count: to.Ptr[int64](1),
SizeGB: to.Ptr[int64](128),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
},
},
},
},
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone),
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](6),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E16ds_v4"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// DiskConfiguration: &armworkloads.DiskConfiguration{
// DiskVolumeConfigurations: map[string]*armworkloads.DiskVolumeConfiguration{
// "backup": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](2),
// SizeGB: to.Ptr[int64](256),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
// },
// },
// "hana/data": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](4),
// SizeGB: to.Ptr[int64](128),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
// },
// },
// "hana/log": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](3),
// SizeGB: to.Ptr[int64](128),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
// },
// },
// "hana/shared": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](1),
// SizeGB: to.Ptr[int64](256),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
// },
// },
// "os": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](1),
// SizeGB: to.Ptr[int64](64),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
// },
// },
// "usr/sap": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](1),
// SizeGB: to.Ptr[int64](128),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
// },
// },
// },
// },
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
// HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone),
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvZone.json
*/
async function createInfrastructureWithDiskAndOSConfigurationForHaSystemWithAvailabilityZoneRecommended() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
applicationServer: {
instanceCount: 6,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
centralServer: {
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E16ds_v4",
},
},
databaseServer: {
databaseType: "HANA",
diskConfiguration: {
diskVolumeConfigurations: {
backup: {
count: 2,
sizeGB: 256,
sku: { name: "StandardSSD_LRS" },
},
"hana/data": {
count: 4,
sizeGB: 128,
sku: { name: "Premium_LRS" },
},
"hana/log": {
count: 3,
sizeGB: 128,
sku: { name: "Premium_LRS" },
},
"hana/shared": {
count: 1,
sizeGB: 256,
sku: { name: "StandardSSD_LRS" },
},
os: { count: 1, sizeGB: 64, sku: { name: "StandardSSD_LRS" } },
"usr/sap": { count: 1, sizeGB: 128, sku: { name: "Premium_LRS" } },
},
},
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
highAvailabilityConfig: { highAvailabilityType: "AvailabilityZone" },
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
},
environment: "Prod",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_HA_AvZone.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("X00-RG", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E16ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 2L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 6L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 2L)
{
DatabaseType = SapDatabaseType.Hana,
DiskVolumeConfigurations =
{
["backup"] = new DiskVolumeConfiguration
{
Count = 2L,
SizeInGB = 256L,
SkuName = DiskDetailsDiskSkuName.StandardSsdLrs,
},
["hana/data"] = new DiskVolumeConfiguration
{
Count = 4L,
SizeInGB = 128L,
SkuName = DiskDetailsDiskSkuName.PremiumLrs,
},
["hana/log"] = new DiskVolumeConfiguration
{
Count = 3L,
SizeInGB = 128L,
SkuName = DiskDetailsDiskSkuName.PremiumLrs,
},
["hana/shared"] = new DiskVolumeConfiguration
{
Count = 1L,
SizeInGB = 256L,
SkuName = DiskDetailsDiskSkuName.StandardSsdLrs,
},
["os"] = new DiskVolumeConfiguration
{
Count = 1L,
SizeInGB = 64L,
SkuName = DiskDetailsDiskSkuName.StandardSsdLrs,
},
["usr/sap"] = new DiskVolumeConfiguration
{
Count = 1L,
SizeInGB = 128L,
SkuName = DiskDetailsDiskSkuName.PremiumLrs,
}
},
})
{
HighAvailabilityType = SapHighAvailabilityType.AvailabilityZone,
},
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilityZone"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"diskConfiguration": {
"diskVolumeConfigurations": {
"hana/data": {
"count": 4,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/log": {
"count": 3,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/shared": {
"count": 1,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"usr/sap": {
"count": 1,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"backup": {
"count": 2,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"os": {
"count": 1,
"sizeGB": 64,
"sku": {
"name": "StandardSSD_LRS"
}
}
}
},
"instanceCount": 2
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilityZone"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"diskConfiguration": {
"diskVolumeConfigurations": {
"hana/data": {
"count": 4,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/log": {
"count": 3,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/shared": {
"count": 1,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"usr/sap": {
"count": 1,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"backup": {
"count": 2,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"os": {
"count": 1,
"sizeGB": 64,
"sku": {
"name": "StandardSSD_LRS"
}
}
}
},
"instanceCount": 2
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure with Disk and OS configurations for Single Server System (Recommended)
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "SingleServer",
"appResourceGroup": "X00-RG",
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"dbDiskConfiguration": {
"diskVolumeConfigurations": {
"hana/data": {
"count": 4,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/log": {
"count": 3,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/shared": {
"count": 1,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"usr/sap": {
"count": 1,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"backup": {
"count": 2,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"os": {
"count": 1,
"sizeGB": 64,
"sku": {
"name": "StandardSSD_LRS"
}
}
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.DiskConfiguration;
import com.azure.resourcemanager.workloads.models.DiskSku;
import com.azure.resourcemanager.workloads.models.DiskSkuName;
import com.azure.resourcemanager.workloads.models.DiskVolumeConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.NetworkConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SingleServerConfiguration;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_DiskDetails_SingleServer.json
*/
/**
* Sample code: Create Infrastructure with Disk and OS configurations for Single Server System (Recommended).
*
* @param manager Entry point to WorkloadsManager.
*/
public static void createInfrastructureWithDiskAndOSConfigurationsForSingleServerSystemRecommended(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.NON_PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new SingleServerConfiguration().withAppResourceGroup("X00-RG")
.withNetworkConfiguration(new NetworkConfiguration().withIsSecondaryIpEnabled(true))
.withDatabaseType(SapDatabaseType.HANA)
.withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withDbDiskConfiguration(new DiskConfiguration().withDiskVolumeConfigurations(mapOf("backup",
new DiskVolumeConfiguration().withCount(2L).withSizeGB(256L)
.withSku(new DiskSku().withName(DiskSkuName.STANDARD_SSD_LRS)),
"hana/data",
new DiskVolumeConfiguration()
.withCount(4L).withSizeGB(128L).withSku(new DiskSku().withName(DiskSkuName.PREMIUM_LRS)),
"hana/log",
new DiskVolumeConfiguration()
.withCount(3L).withSizeGB(128L).withSku(new DiskSku().withName(DiskSkuName.PREMIUM_LRS)),
"hana/shared",
new DiskVolumeConfiguration().withCount(1L).withSizeGB(256L)
.withSku(new DiskSku().withName(DiskSkuName.STANDARD_SSD_LRS)),
"os",
new DiskVolumeConfiguration().withCount(1L).withSizeGB(64L)
.withSku(new DiskSku().withName(DiskSkuName.STANDARD_SSD_LRS)),
"usr/sap",
new DiskVolumeConfiguration().withCount(1L).withSizeGB(128L)
.withSku(new DiskSku().withName(DiskSkuName.PREMIUM_LRS))))))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_disk_details_single_server.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_SingleServer.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_SingleServer.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithDiskAndOsConfigurationsForSingleServerSystemRecommended() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer),
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
DbDiskConfiguration: &armworkloads.DiskConfiguration{
DiskVolumeConfigurations: map[string]*armworkloads.DiskVolumeConfiguration{
"backup": {
Count: to.Ptr[int64](2),
SizeGB: to.Ptr[int64](256),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
},
},
"hana/data": {
Count: to.Ptr[int64](4),
SizeGB: to.Ptr[int64](128),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
},
},
"hana/log": {
Count: to.Ptr[int64](3),
SizeGB: to.Ptr[int64](128),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
},
},
"hana/shared": {
Count: to.Ptr[int64](1),
SizeGB: to.Ptr[int64](256),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
},
},
"os": {
Count: to.Ptr[int64](1),
SizeGB: to.Ptr[int64](64),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
},
},
"usr/sap": {
Count: to.Ptr[int64](1),
SizeGB: to.Ptr[int64](128),
SKU: &armworkloads.DiskSKU{
Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
},
},
},
},
NetworkConfiguration: &armworkloads.NetworkConfiguration{
IsSecondaryIPEnabled: to.Ptr(true),
},
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer),
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// DbDiskConfiguration: &armworkloads.DiskConfiguration{
// DiskVolumeConfigurations: map[string]*armworkloads.DiskVolumeConfiguration{
// "backup": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](2),
// SizeGB: to.Ptr[int64](256),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
// },
// },
// "hana/data": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](4),
// SizeGB: to.Ptr[int64](128),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
// },
// },
// "hana/log": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](3),
// SizeGB: to.Ptr[int64](128),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
// },
// },
// "hana/shared": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](1),
// SizeGB: to.Ptr[int64](256),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
// },
// },
// "os": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](1),
// SizeGB: to.Ptr[int64](64),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNameStandardSSDLRS),
// },
// },
// "usr/sap": &armworkloads.DiskVolumeConfiguration{
// Count: to.Ptr[int64](1),
// SizeGB: to.Ptr[int64](128),
// SKU: &armworkloads.DiskSKU{
// Name: to.Ptr(armworkloads.DiskSKUNamePremiumLRS),
// },
// },
// },
// },
// NetworkConfiguration: &armworkloads.NetworkConfiguration{
// IsSecondaryIPEnabled: to.Ptr(true),
// },
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_SingleServer.json
*/
async function createInfrastructureWithDiskAndOSConfigurationsForSingleServerSystemRecommended() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
databaseType: "HANA",
dbDiskConfiguration: {
diskVolumeConfigurations: {
backup: { count: 2, sizeGB: 256, sku: { name: "StandardSSD_LRS" } },
"hana/data": {
count: 4,
sizeGB: 128,
sku: { name: "Premium_LRS" },
},
"hana/log": { count: 3, sizeGB: 128, sku: { name: "Premium_LRS" } },
"hana/shared": {
count: 1,
sizeGB: 256,
sku: { name: "StandardSSD_LRS" },
},
os: { count: 1, sizeGB: 64, sku: { name: "StandardSSD_LRS" } },
"usr/sap": { count: 1, sizeGB: 128, sku: { name: "Premium_LRS" } },
},
},
deploymentType: "SingleServer",
networkConfiguration: { isSecondaryIpEnabled: true },
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
},
environment: "NonProd",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_DiskDetails_SingleServer.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.NonProd, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new SingleServerConfiguration("X00-RG", new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}))
{
IsSecondaryIPEnabled = true,
DatabaseType = SapDatabaseType.Hana,
DiskVolumeConfigurations =
{
["backup"] = new DiskVolumeConfiguration
{
Count = 2L,
SizeInGB = 256L,
SkuName = DiskDetailsDiskSkuName.StandardSsdLrs,
},
["hana/data"] = new DiskVolumeConfiguration
{
Count = 4L,
SizeInGB = 128L,
SkuName = DiskDetailsDiskSkuName.PremiumLrs,
},
["hana/log"] = new DiskVolumeConfiguration
{
Count = 3L,
SizeInGB = 128L,
SkuName = DiskDetailsDiskSkuName.PremiumLrs,
},
["hana/shared"] = new DiskVolumeConfiguration
{
Count = 1L,
SizeInGB = 256L,
SkuName = DiskDetailsDiskSkuName.StandardSsdLrs,
},
["os"] = new DiskVolumeConfiguration
{
Count = 1L,
SizeInGB = 64L,
SkuName = DiskDetailsDiskSkuName.StandardSsdLrs,
},
["usr/sap"] = new DiskVolumeConfiguration
{
Count = 1L,
SizeInGB = 128L,
SkuName = DiskDetailsDiskSkuName.PremiumLrs,
}
},
},
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "SingleServer",
"appResourceGroup": "X00-RG",
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"dbDiskConfiguration": {
"diskVolumeConfigurations": {
"hana/data": {
"count": 4,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/log": {
"count": 3,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/shared": {
"count": 1,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"usr/sap": {
"count": 1,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"backup": {
"count": 2,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"os": {
"count": 1,
"sizeGB": 64,
"sku": {
"name": "StandardSSD_LRS"
}
}
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "SingleServer",
"appResourceGroup": "X00-RG",
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/dindurkhya-e2etesting/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"dbDiskConfiguration": {
"diskVolumeConfigurations": {
"hana/data": {
"count": 4,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/log": {
"count": 3,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"hana/shared": {
"count": 1,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"usr/sap": {
"count": 1,
"sizeGB": 128,
"sku": {
"name": "Premium_LRS"
}
},
"backup": {
"count": 2,
"sizeGB": 256,
"sku": {
"name": "StandardSSD_LRS"
}
},
"os": {
"count": 1,
"sizeGB": 64,
"sku": {
"name": "StandardSSD_LRS"
}
}
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure with OS configuration for Distributed System (Recommended)
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 1
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_WithOSConfig_Distributed.json
*/
/**
* Sample code: Create Infrastructure with OS configuration for Distributed System (Recommended).
*
* @param manager Entry point to WorkloadsManager.
*/
public static void createInfrastructureWithOSConfigurationForDistributedSystemRecommended(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("X00-RG")
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize(
"Standard_E16ds_v4").withImageReference(
new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP").withSku(
"84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}").withOsConfiguration(
new LinuxConfiguration().withDisablePasswordAuthentication(true).withSshKeyPair(
new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(1L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(6L))
.withDatabaseServer(new DatabaseConfiguration().withDatabaseType(SapDatabaseType.HANA).withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(1L)))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_with_os_config_distributed.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_Distributed.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_Distributed.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationForDistributedSystemRecommended() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](6),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E16ds_v4"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](6),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E16ds_v4"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_Distributed.json
*/
async function createInfrastructureWithOSConfigurationForDistributedSystemRecommended() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
applicationServer: {
instanceCount: 6,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
centralServer: {
instanceCount: 1,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E16ds_v4",
},
},
databaseServer: {
databaseType: "HANA",
instanceCount: 1,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
},
environment: "Prod",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_Distributed.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("X00-RG", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E16ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 1L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 6L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 1L)
{
DatabaseType = SapDatabaseType.Hana,
}),
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure with OS configuration for HA System with Availability Set (Recommended)
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilitySet"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 2
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.HighAvailabilityConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapHighAvailabilityType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_WithOSConfig_HA_AvSet.json
*/
/**
* Sample code: Create Infrastructure with OS configuration for HA System with Availability Set (Recommended).
*
* @param manager Entry point to WorkloadsManager.
*/
public static void createInfrastructureWithOSConfigurationForHASystemWithAvailabilitySetRecommended(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("X00-RG")
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize(
"Standard_E16ds_v4").withImageReference(
new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP").withSku(
"84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}").withOsConfiguration(
new LinuxConfiguration().withDisablePasswordAuthentication(true).withSshKeyPair(
new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(2L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(6L))
.withDatabaseServer(new DatabaseConfiguration().withDatabaseType(SapDatabaseType.HANA).withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(2L))
.withHighAvailabilityConfig(new HighAvailabilityConfiguration()
.withHighAvailabilityType(SapHighAvailabilityType.AVAILABILITY_SET)))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_with_os_config_ha_av_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 = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvSet.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvSet.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationForHaSystemWithAvailabilitySetRecommended() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](6),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E16ds_v4"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet),
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](6),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E16ds_v4"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
// HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet),
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvSet.json
*/
async function createInfrastructureWithOSConfigurationForHaSystemWithAvailabilitySetRecommended() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
applicationServer: {
instanceCount: 6,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
centralServer: {
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E16ds_v4",
},
},
databaseServer: {
databaseType: "HANA",
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
highAvailabilityConfig: { highAvailabilityType: "AvailabilitySet" },
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
},
environment: "Prod",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvSet.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("X00-RG", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E16ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 2L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 6L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 2L)
{
DatabaseType = SapDatabaseType.Hana,
})
{
HighAvailabilityType = SapHighAvailabilityType.AvailabilitySet,
},
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilitySet"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilitySet"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure with OS configuration for HA System with Availability Zone (Recommended)
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilityZone"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 2
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.HighAvailabilityConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapHighAvailabilityType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_WithOSConfig_HA_AvZone.json
*/
/**
* Sample code: Create Infrastructure with OS configuration for HA System with Availability Zone (Recommended).
*
* @param manager Entry point to WorkloadsManager.
*/
public static void createInfrastructureWithOSConfigurationForHASystemWithAvailabilityZoneRecommended(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("X00-RG")
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize(
"Standard_E16ds_v4").withImageReference(
new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP").withSku(
"84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}").withOsConfiguration(
new LinuxConfiguration().withDisablePasswordAuthentication(true).withSshKeyPair(
new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(2L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(6L))
.withDatabaseServer(new DatabaseConfiguration().withDatabaseType(SapDatabaseType.HANA).withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(2L))
.withHighAvailabilityConfig(new HighAvailabilityConfiguration()
.withHighAvailabilityType(SapHighAvailabilityType.AVAILABILITY_ZONE)))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_with_os_config_ha_av_zone.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvZone.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvZone.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationForHaSystemWithAvailabilityZoneRecommended() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](6),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E16ds_v4"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone),
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](6),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E16ds_v4"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
// HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone),
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvZone.json
*/
async function createInfrastructureWithOSConfigurationForHaSystemWithAvailabilityZoneRecommended() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
applicationServer: {
instanceCount: 6,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
centralServer: {
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E16ds_v4",
},
},
databaseServer: {
databaseType: "HANA",
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
highAvailabilityConfig: { highAvailabilityType: "AvailabilityZone" },
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
},
environment: "Prod",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_HA_AvZone.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("X00-RG", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E16ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 2L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 6L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 2L)
{
DatabaseType = SapDatabaseType.Hana,
})
{
HighAvailabilityType = SapHighAvailabilityType.AvailabilityZone,
},
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilityZone"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilityZone"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure with OS configuration for Single Server System (Recommended)
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "SingleServer",
"appResourceGroup": "X00-RG",
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.NetworkConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SingleServerConfiguration;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_WithOSConfig_SingleServer.json
*/
/**
* Sample code: Create Infrastructure with OS configuration for Single Server System (Recommended).
*
* @param manager Entry point to WorkloadsManager.
*/
public static void createInfrastructureWithOSConfigurationForSingleServerSystemRecommended(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.NON_PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new SingleServerConfiguration().withAppResourceGroup("X00-RG")
.withNetworkConfiguration(new NetworkConfiguration().withIsSecondaryIpEnabled(true))
.withDatabaseType(SapDatabaseType.HANA)
.withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder"))))))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_with_os_config_single_server.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_SingleServer.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_SingleServer.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithOsConfigurationForSingleServerSystemRecommended() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer),
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
NetworkConfiguration: &armworkloads.NetworkConfiguration{
IsSecondaryIPEnabled: to.Ptr(true),
},
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer),
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// NetworkConfiguration: &armworkloads.NetworkConfiguration{
// IsSecondaryIPEnabled: to.Ptr(true),
// },
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_SingleServer.json
*/
async function createInfrastructureWithOSConfigurationForSingleServerSystemRecommended() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
databaseType: "HANA",
deploymentType: "SingleServer",
networkConfiguration: { isSecondaryIpEnabled: true },
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
},
environment: "NonProd",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_WithOSConfig_SingleServer.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.NonProd, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new SingleServerConfiguration("X00-RG", new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}))
{
IsSecondaryIPEnabled = true,
DatabaseType = SapDatabaseType.Hana,
},
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "SingleServer",
"appResourceGroup": "X00-RG",
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "SingleServer",
"appResourceGroup": "X00-RG",
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Create Infrastructure without a SAP Transport Directory Fileshare
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"storageConfiguration": {
"transportFileShareConfiguration": {
"configurationType": "Skip"
}
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 1
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SkipFileShareConfiguration;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.StorageConfiguration;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_Distributed_SkipTransport.json
*/
/**
* Sample code: Create Infrastructure without a SAP Transport Directory Fileshare.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void createInfrastructureWithoutASAPTransportDirectoryFileshare(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("X00-RG")
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize(
"Standard_E16ds_v4").withImageReference(
new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP").withSku(
"84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}").withOsConfiguration(
new LinuxConfiguration().withDisablePasswordAuthentication(true).withSshKeyPair(
new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(1L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(6L))
.withDatabaseServer(new DatabaseConfiguration().withDatabaseType(SapDatabaseType.HANA).withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(1L))
.withStorageConfiguration(new StorageConfiguration()
.withTransportFileShareConfiguration(new SkipFileShareConfiguration())))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_distributed_skip_transport.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_SkipTransport.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_SkipTransport.json
func ExampleSAPVirtualInstancesClient_BeginCreate_createInfrastructureWithoutASapTransportDirectoryFileshare() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](6),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E16ds_v4"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
StorageConfiguration: &armworkloads.StorageConfiguration{
TransportFileShareConfiguration: &armworkloads.SkipFileShareConfiguration{
ConfigurationType: to.Ptr(armworkloads.ConfigurationTypeSkip),
},
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](6),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E16ds_v4"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// StorageConfiguration: &armworkloads.StorageConfiguration{
// TransportFileShareConfiguration: &armworkloads.SkipFileShareConfiguration{
// ConfigurationType: to.Ptr(armworkloads.ConfigurationTypeSkip),
// },
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// Health: to.Ptr(armworkloads.SAPHealthStateUnknown),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationPending),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatus("Unknown")),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_SkipTransport.json
*/
async function createInfrastructureWithoutASapTransportDirectoryFileshare() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
applicationServer: {
instanceCount: 6,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
centralServer: {
instanceCount: 1,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E16ds_v4",
},
},
databaseServer: {
databaseType: "HANA",
instanceCount: 1,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
storageConfiguration: {
transportFileShareConfiguration: { configurationType: "Skip" },
},
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
},
environment: "Prod",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Distributed_SkipTransport.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("X00-RG", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E16ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 1L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 6L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 1L)
{
DatabaseType = SapDatabaseType.Hana,
})
{
StorageTransportFileShareConfiguration = new SkipFileShareConfiguration(),
},
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"storageConfiguration": {
"transportFileShareConfiguration": {
"configurationType": "Skip"
}
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "SoftwareInstallationPending",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "X00-RG",
"storageConfiguration": {
"transportFileShareConfiguration": {
"configurationType": "Skip"
}
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 1
}
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"status": "Unknown",
"health": "Unknown",
"state": "InfrastructureDeploymentInProgress",
"provisioningState": "Updating"
}
}
Detect SAP Software Installation on a Distributed System
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {
"created by": "azureuser"
},
"location": "eastus2",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "{{resourcegrp}}",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_E4ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "{{sshkey}}",
"privateKey": "{{privateKey}}"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_E4ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "{{sshkey}}",
"privateKey": "{{privateKey}}"
}
}
}
},
"instanceCount": 2
},
"databaseServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "{{sshkey}}",
"privateKey": "{{privateKey}}"
}
}
}
},
"instanceCount": 1
}
},
"softwareConfiguration": {
"softwareInstallationType": "External",
"centralServerVmId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"
},
"osSapConfiguration": {
"sapFqdn": "sap.bpaas.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.ExternalInstallationSoftwareConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.NetworkConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_DetectInstallation_Distributed.json
*/
/**
* Sample code: Detect SAP Software Installation on a Distributed System.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void detectSAPSoftwareInstallationOnADistributedSystem(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("eastus2").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("{{resourcegrp}}")
.withNetworkConfiguration(new NetworkConfiguration().withIsSecondaryIpEnabled(true))
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E4ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP-HA")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("azureuser")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(1L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E4ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP-HA")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("azureuser")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(2L))
.withDatabaseServer(new DatabaseConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP-HA")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("azureuser")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(1L)))
.withSoftwareConfiguration(new ExternalInstallationSoftwareConfiguration().withCentralServerVmId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("sap.bpaas.com")))
.withTags(mapOf("created by", "azureuser")).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_detect_installation_distributed.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_Distributed.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_Distributed.json
func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnADistributedSystem() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("eastus2"),
Tags: map[string]*string{
"created by": to.Ptr("azureuser"),
},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("{{resourcegrp}}"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP-HA"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("azureuser"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("{{privateKey}}"),
PublicKey: to.Ptr("{{sshkey}}"),
},
},
},
VMSize: to.Ptr("Standard_E4ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP-HA"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("azureuser"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("{{privateKey}}"),
PublicKey: to.Ptr("{{sshkey}}"),
},
},
},
VMSize: to.Ptr("Standard_E4ds_v4"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP-HA"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("azureuser"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("{{privateKey}}"),
PublicKey: to.Ptr("{{sshkey}}"),
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
NetworkConfiguration: &armworkloads.NetworkConfiguration{
IsSecondaryIPEnabled: to.Ptr(true),
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("sap.bpaas.com"),
},
SoftwareConfiguration: &armworkloads.ExternalInstallationSoftwareConfiguration{
SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeExternal),
CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("microsoft.workloads/sapvirtualinstances"),
// ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.240Z"); return t}()),
// CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.194Z"); return t}()),
// LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeApplication),
// },
// Location: to.Ptr("eastus2"),
// Tags: map[string]*string{
// "created by": to.Ptr("azureuser"),
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("aa-rg"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP-HA"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("azureuser"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E4ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP-HA"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("azureuser"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E4ds_v4"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP-HA"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("azureuser"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"),
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// NetworkConfiguration: &armworkloads.NetworkConfiguration{
// IsSecondaryIPEnabled: to.Ptr(true),
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("sap.bpaas.com"),
// },
// SoftwareConfiguration: &armworkloads.ExternalInstallationSoftwareConfiguration{
// SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeExternal),
// CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateRegistrationComplete),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_Distributed.json
*/
async function detectSapSoftwareInstallationOnADistributedSystem() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "{{resourcegrp}}",
applicationServer: {
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP-HA",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "azureuser",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: {
privateKey: "{{privateKey}}",
publicKey: "{{sshkey}}",
},
},
},
vmSize: "Standard_E4ds_v4",
},
},
centralServer: {
instanceCount: 1,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP-HA",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "azureuser",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: {
privateKey: "{{privateKey}}",
publicKey: "{{sshkey}}",
},
},
},
vmSize: "Standard_E4ds_v4",
},
},
databaseServer: {
instanceCount: 1,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP-HA",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "azureuser",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: {
privateKey: "{{privateKey}}",
publicKey: "{{sshkey}}",
},
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
networkConfiguration: { isSecondaryIpEnabled: true },
},
osSapConfiguration: { sapFqdn: "sap.bpaas.com" },
softwareConfiguration: {
centralServerVmId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0",
softwareInstallationType: "External",
},
},
environment: "Prod",
location: "eastus2",
sapProduct: "S4HANA",
tags: { createdBy: "azureuser" },
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_Distributed.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("eastus2"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("{{resourcegrp}}", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), new SapVirtualMachineConfiguration("Standard_E4ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP-HA",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "azureuser",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "{{sshkey}}",
PrivateKey = "{{privateKey}}",
},
},
}), 1L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), new SapVirtualMachineConfiguration("Standard_E4ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP-HA",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "azureuser",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "{{sshkey}}",
PrivateKey = "{{privateKey}}",
},
},
}), 2L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP-HA",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "azureuser",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "{{sshkey}}",
PrivateKey = "{{privateKey}}",
},
},
}), 1L))
{
IsSecondaryIPEnabled = true,
},
SoftwareConfiguration = new ExternalInstallationSoftwareConfiguration
{
CentralServerVmId = new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"),
},
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "sap.bpaas.com",
},
})
{
Tags =
{
["created by"] = "azureuser"
},
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "microsoft.workloads/sapvirtualinstances",
"location": "eastus2",
"tags": {
"created by": "azureuser"
},
"systemData": {
"createdBy": "f1bc9460-9d57-4c16-99a8-5a19378a3a93",
"createdByType": "Application",
"createdAt": "2022-08-18T18:25:55.2406546Z",
"lastModifiedBy": "f1bc9460-9d57-4c16-99a8-5a19378a3a93",
"lastModifiedByType": "Application",
"lastModifiedAt": "2022-08-18T18:50:59.1945444Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_E4ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_E4ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 2
},
"databaseServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 1
},
"appResourceGroup": "aa-rg"
},
"softwareConfiguration": {
"softwareInstallationType": "External",
"centralServerVmId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"
},
"osSapConfiguration": {
"sapFqdn": "sap.bpaas.com"
}
},
"state": "RegistrationComplete",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/aa-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "microsoft.workloads/sapvirtualinstances",
"location": "eastus2",
"tags": {
"created by": "azureuser"
},
"systemData": {
"createdBy": "f1bc9460-9d57-4c16-99a8-5a19378a3a93",
"createdByType": "Application",
"createdAt": "2022-08-18T18:25:55.2406546Z",
"lastModifiedBy": "f1bc9460-9d57-4c16-99a8-5a19378a3a93",
"lastModifiedByType": "Application",
"lastModifiedAt": "2022-08-18T18:50:59.1945444Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_E4ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_E4ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 2
},
"databaseServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 1
},
"appResourceGroup": "aa-rg"
},
"softwareConfiguration": {
"softwareInstallationType": "External",
"centralServerVmId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"
},
"osSapConfiguration": {
"sapFqdn": "sap.bpaas.com"
}
},
"state": "SoftwareDetectionInProgress",
"provisioningState": "Accepted"
}
}
Detect SAP Software Installation on a Single Server System
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "SingleServer",
"appResourceGroup": "X00-RG",
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
}
},
"softwareConfiguration": {
"softwareInstallationType": "External",
"centralServerVmId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.ExternalInstallationSoftwareConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.NetworkConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SingleServerConfiguration;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_DetectInstallation_SingleServer.json
*/
/**
* Sample code: Detect SAP Software Installation on a Single Server System.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void detectSAPSoftwareInstallationOnASingleServerSystem(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.NON_PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new SingleServerConfiguration().withAppResourceGroup("X00-RG")
.withNetworkConfiguration(new NetworkConfiguration().withIsSecondaryIpEnabled(true))
.withDatabaseType(SapDatabaseType.HANA)
.withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP-HA")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder"))))))
.withSoftwareConfiguration(new ExternalInstallationSoftwareConfiguration().withCentralServerVmId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_detect_installation_single_server.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_SingleServer.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_SingleServer.json
func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnASingleServerSystem() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer),
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
NetworkConfiguration: &armworkloads.NetworkConfiguration{
IsSecondaryIPEnabled: to.Ptr(true),
},
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP-HA"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
SoftwareConfiguration: &armworkloads.ExternalInstallationSoftwareConfiguration{
SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeExternal),
CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer),
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// NetworkConfiguration: &armworkloads.NetworkConfiguration{
// IsSecondaryIPEnabled: to.Ptr(true),
// },
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP-HA"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// SoftwareConfiguration: &armworkloads.ExternalInstallationSoftwareConfiguration{
// SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeExternal),
// CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateRegistrationComplete),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_SingleServer.json
*/
async function detectSapSoftwareInstallationOnASingleServerSystem() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
databaseType: "HANA",
deploymentType: "SingleServer",
networkConfiguration: { isSecondaryIpEnabled: true },
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP-HA",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
softwareConfiguration: {
centralServerVmId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0",
softwareInstallationType: "External",
},
},
environment: "NonProd",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_SingleServer.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.NonProd, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new SingleServerConfiguration("X00-RG", new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP-HA",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}))
{
IsSecondaryIPEnabled = true,
DatabaseType = SapDatabaseType.Hana,
},
SoftwareConfiguration = new ExternalInstallationSoftwareConfiguration
{
CentralServerVmId = new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"),
},
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "SingleServer",
"appResourceGroup": "X00-RG",
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
}
},
"softwareConfiguration": {
"softwareInstallationType": "External",
"centralServerVmId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"state": "RegistrationComplete",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "SingleServer",
"appResourceGroup": "X00-RG",
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
}
},
"softwareConfiguration": {
"softwareInstallationType": "External",
"centralServerVmId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"state": "SoftwareDetectionInProgress",
"provisioningState": "Accepted"
}
}
Detect SAP Software Installation on an HA System with Availability Set
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilitySet"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 2
}
},
"softwareConfiguration": {
"softwareInstallationType": "External",
"centralServerVmId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.ExternalInstallationSoftwareConfiguration;
import com.azure.resourcemanager.workloads.models.HighAvailabilityConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapHighAvailabilityType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_DetectInstallation_HA_AvSet.json
*/
/**
* Sample code: Detect SAP Software Installation on an HA System with Availability Set.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void detectSAPSoftwareInstallationOnAnHASystemWithAvailabilitySet(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("X00-RG")
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize(
"Standard_E16ds_v4").withImageReference(
new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP-HA").withSku(
"84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}").withOsConfiguration(
new LinuxConfiguration().withDisablePasswordAuthentication(true).withSshKeyPair(
new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(2L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP-HA")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(6L))
.withDatabaseServer(new DatabaseConfiguration().withDatabaseType(SapDatabaseType.HANA).withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP-HA")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(2L))
.withHighAvailabilityConfig(new HighAvailabilityConfiguration()
.withHighAvailabilityType(SapHighAvailabilityType.AVAILABILITY_SET)))
.withSoftwareConfiguration(new ExternalInstallationSoftwareConfiguration().withCentralServerVmId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_detect_installation_ha_av_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 = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvSet.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvSet.json
func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnAnHaSystemWithAvailabilitySet() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](6),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP-HA"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP-HA"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E16ds_v4"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP-HA"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet),
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
SoftwareConfiguration: &armworkloads.ExternalInstallationSoftwareConfiguration{
SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeExternal),
CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](6),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP-HA"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP-HA"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E16ds_v4"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP-HA"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
// HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilitySet),
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// SoftwareConfiguration: &armworkloads.ExternalInstallationSoftwareConfiguration{
// SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeExternal),
// CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateRegistrationComplete),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvSet.json
*/
async function detectSapSoftwareInstallationOnAnHaSystemWithAvailabilitySet() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
applicationServer: {
instanceCount: 6,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP-HA",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
centralServer: {
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP-HA",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E16ds_v4",
},
},
databaseServer: {
databaseType: "HANA",
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP-HA",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
highAvailabilityConfig: { highAvailabilityType: "AvailabilitySet" },
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
softwareConfiguration: {
centralServerVmId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0",
softwareInstallationType: "External",
},
},
environment: "Prod",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvSet.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("X00-RG", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E16ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP-HA",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 2L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP-HA",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 6L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP-HA",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 2L)
{
DatabaseType = SapDatabaseType.Hana,
})
{
HighAvailabilityType = SapHighAvailabilityType.AvailabilitySet,
},
SoftwareConfiguration = new ExternalInstallationSoftwareConfiguration
{
CentralServerVmId = new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"),
},
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilitySet"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
}
},
"softwareConfiguration": {
"softwareInstallationType": "External",
"centralServerVmId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"state": "RegistrationComplete",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilitySet"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
}
},
"softwareConfiguration": {
"softwareInstallationType": "External",
"centralServerVmId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"state": "SoftwareDetectionInProgress",
"provisioningState": "Accepted"
}
}
Detect SAP Software Installation on an HA System with Availability Zone
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "westcentralus",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilityZone"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc",
"privateKey": "xyz"
}
}
}
},
"instanceCount": 2
}
},
"softwareConfiguration": {
"softwareInstallationType": "External",
"centralServerVmId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.ExternalInstallationSoftwareConfiguration;
import com.azure.resourcemanager.workloads.models.HighAvailabilityConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapDatabaseType;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapHighAvailabilityType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_DetectInstallation_HA_AvZone.json
*/
/**
* Sample code: Detect SAP Software Installation on an HA System with Availability Zone.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void detectSAPSoftwareInstallationOnAnHASystemWithAvailabilityZone(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("westcentralus").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("X00-RG")
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize(
"Standard_E16ds_v4").withImageReference(
new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP-HA").withSku(
"84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}").withOsConfiguration(
new LinuxConfiguration().withDisablePasswordAuthentication(true).withSshKeyPair(
new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(2L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP-HA")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(6L))
.withDatabaseServer(new DatabaseConfiguration().withDatabaseType(SapDatabaseType.HANA).withSubnetId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP-HA")
.withSku("84sapha-gen2").withVersion("latest"))
.withOsProfile(new OSProfile().withAdminUsername("{your-username}")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(2L))
.withHighAvailabilityConfig(new HighAvailabilityConfiguration()
.withHighAvailabilityType(SapHighAvailabilityType.AVAILABILITY_ZONE)))
.withSoftwareConfiguration(new ExternalInstallationSoftwareConfiguration().withCentralServerVmId(
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("xyz.test.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_detect_installation_ha_av_zone.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvZone.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvZone.json
func ExampleSAPVirtualInstancesClient_BeginCreate_detectSapSoftwareInstallationOnAnHaSystemWithAvailabilityZone() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("westcentralus"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("X00-RG"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](6),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP-HA"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP-HA"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_E16ds_v4"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP-HA"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("84sapha-gen2"),
Version: to.Ptr("latest"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("{your-username}"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("xyz"),
PublicKey: to.Ptr("abc"),
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone),
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("xyz.test.com"),
},
SoftwareConfiguration: &armworkloads.ExternalInstallationSoftwareConfiguration{
SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeExternal),
CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("Microsoft.Workloads/sapVirtualInstances"),
// ID: to.Ptr("/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// CreatedBy: to.Ptr("user@xyz.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-19T15:10:46.196Z"); return t}()),
// LastModifiedBy: to.Ptr("user@xyz.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("westcentralus"),
// Tags: map[string]*string{
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("X00-RG"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](6),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP-HA"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E32ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP-HA"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E16ds_v4"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// DatabaseType: to.Ptr(armworkloads.SAPDatabaseTypeHANA),
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP-HA"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("{your-username}"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("abc"),
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// HighAvailabilityConfig: &armworkloads.HighAvailabilityConfiguration{
// HighAvailabilityType: to.Ptr(armworkloads.SAPHighAvailabilityTypeAvailabilityZone),
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("xyz.test.com"),
// },
// SoftwareConfiguration: &armworkloads.ExternalInstallationSoftwareConfiguration{
// SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeExternal),
// CentralServerVMID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateRegistrationComplete),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvZone.json
*/
async function detectSapSoftwareInstallationOnAnHaSystemWithAvailabilityZone() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "X00-RG",
applicationServer: {
instanceCount: 6,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP-HA",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E32ds_v4",
},
},
centralServer: {
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP-HA",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_E16ds_v4",
},
},
databaseServer: {
databaseType: "HANA",
instanceCount: 2,
subnetId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP-HA",
publisher: "RedHat",
sku: "84sapha-gen2",
version: "latest",
},
osProfile: {
adminUsername: "{your-username}",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: { privateKey: "xyz", publicKey: "abc" },
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
highAvailabilityConfig: { highAvailabilityType: "AvailabilityZone" },
},
osSapConfiguration: { sapFqdn: "xyz.test.com" },
softwareConfiguration: {
centralServerVmId:
"/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0",
softwareInstallationType: "External",
},
},
environment: "Prod",
location: "westcentralus",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_DetectInstallation_HA_AvZone.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("westcentralus"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("X00-RG", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E16ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP-HA",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 2L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP-HA",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 6L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP-HA",
Sku = "84sapha-gen2",
Version = "latest",
}, new SapOSProfile
{
AdminUsername = "{your-username}",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "abc",
PrivateKey = "xyz",
},
},
}), 2L)
{
DatabaseType = SapDatabaseType.Hana,
})
{
HighAvailabilityType = SapHighAvailabilityType.AvailabilityZone,
},
SoftwareConfiguration = new ExternalInstallationSoftwareConfiguration
{
CentralServerVmId = new ResourceIdentifier("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"),
},
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "xyz.test.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilityZone"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
}
},
"softwareConfiguration": {
"softwareInstallationType": "External",
"centralServerVmId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"state": "RegistrationComplete",
"provisioningState": "Succeeded"
}
}
{
"id": "/subscriptions/6d875e77-e412-4d7d-9af4-8895278b4443/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "Microsoft.Workloads/sapVirtualInstances",
"tags": {},
"location": "westcentralus",
"systemData": {
"createdBy": "user@xyz.com",
"createdByType": "User",
"createdAt": "2021-08-19T15:10:46.196Z",
"lastModifiedBy": "user@xyz.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2021-08-19T15:10:46.196Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"appResourceGroup": "X00-RG",
"deploymentType": "ThreeTier",
"highAvailabilityConfig": {
"highAvailabilityType": "AvailabilityZone"
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E16ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/appsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 6
},
"databaseServer": {
"databaseType": "HANA",
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/dbsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "{your-username}",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "abc"
}
}
}
},
"instanceCount": 2
}
},
"softwareConfiguration": {
"softwareInstallationType": "External",
"centralServerVmId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"
},
"osSapConfiguration": {
"sapFqdn": "xyz.test.com"
}
},
"state": "SoftwareDetectionInProgress",
"provisioningState": "Accepted"
}
}
Install SAP Software on Distributed System
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {
"created by": "azureuser"
},
"location": "eastus2",
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"appResourceGroup": "{{resourcegrp}}",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"centralServer": {
"subnetId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_E4ds_v4",
"imageReference": {
"sku": "8.2",
"publisher": "RedHat",
"version": "8.2.2021091201",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "{{sshkey}}",
"privateKey": "{{privateKey}}"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_E4ds_v4",
"imageReference": {
"sku": "8.2",
"publisher": "RedHat",
"version": "8.2.2021091201",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "{{sshkey}}",
"privateKey": "{{privateKey}}"
}
}
}
},
"instanceCount": 2
},
"databaseServer": {
"subnetId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "8.2",
"publisher": "RedHat",
"version": "8.2.2021091201",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "{{sshkey}}",
"privateKey": "{{privateKey}}"
}
}
}
},
"instanceCount": 1
}
},
"softwareConfiguration": {
"softwareInstallationType": "SAPInstallWithoutOSConfig",
"bomUrl": "https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml",
"softwareVersion": "SAP S/4HANA 1909 SPS 03",
"sapBitsStorageAccountId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"
},
"osSapConfiguration": {
"sapFqdn": "sap.bpaas.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.ApplicationServerConfiguration;
import com.azure.resourcemanager.workloads.models.CentralServerConfiguration;
import com.azure.resourcemanager.workloads.models.DatabaseConfiguration;
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.NetworkConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapInstallWithoutOSConfigSoftwareConfiguration;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.ThreeTierConfiguration;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Install_Distributed.json
*/
/**
* Sample code: Install SAP Software on Distributed System.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void
installSAPSoftwareOnDistributedSystem(com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("eastus2").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new ThreeTierConfiguration().withAppResourceGroup("{{resourcegrp}}")
.withNetworkConfiguration(new NetworkConfiguration().withIsSecondaryIpEnabled(true))
.withCentralServer(new CentralServerConfiguration().withSubnetId(
"/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E4ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP-HA")
.withSku("8.2").withVersion("8.2.2021091201"))
.withOsProfile(new OSProfile().withAdminUsername("azureuser")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(1L))
.withApplicationServer(new ApplicationServerConfiguration().withSubnetId(
"/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withVmSize("Standard_E4ds_v4")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP-HA")
.withSku("8.2").withVersion("8.2.2021091201"))
.withOsProfile(new OSProfile().withAdminUsername("azureuser")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(2L))
.withDatabaseServer(new DatabaseConfiguration().withSubnetId(
"/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_M32ts")
.withImageReference(new ImageReference().withPublisher("RedHat").withOffer("RHEL-SAP-HA")
.withSku("8.2").withVersion("8.2.2021091201"))
.withOsProfile(new OSProfile().withAdminUsername("azureuser")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder")))))
.withInstanceCount(1L)))
.withSoftwareConfiguration(new SapInstallWithoutOSConfigSoftwareConfiguration().withBomUrl(
"https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml")
.withSapBitsStorageAccountId(
"/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount")
.withSoftwareVersion("SAP S/4HANA 1909 SPS 03"))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("sap.bpaas.com")))
.withTags(mapOf("created by", "azureuser")).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_install_distributed.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Install_Distributed.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Install_Distributed.json
func ExampleSAPVirtualInstancesClient_BeginCreate_installSapSoftwareOnDistributedSystem() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("eastus2"),
Tags: map[string]*string{
"created by": to.Ptr("azureuser"),
},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
AppResourceGroup: to.Ptr("{{resourcegrp}}"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
ApplicationServer: &armworkloads.ApplicationServerConfiguration{
InstanceCount: to.Ptr[int64](2),
SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP-HA"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("8.2"),
Version: to.Ptr("8.2.2021091201"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("azureuser"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("{{privateKey}}"),
PublicKey: to.Ptr("{{sshkey}}"),
},
},
},
VMSize: to.Ptr("Standard_E4ds_v4"),
},
},
CentralServer: &armworkloads.CentralServerConfiguration{
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP-HA"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("8.2"),
Version: to.Ptr("8.2.2021091201"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("azureuser"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("{{privateKey}}"),
PublicKey: to.Ptr("{{sshkey}}"),
},
},
},
VMSize: to.Ptr("Standard_E4ds_v4"),
},
},
DatabaseServer: &armworkloads.DatabaseConfiguration{
InstanceCount: to.Ptr[int64](1),
SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("RHEL-SAP-HA"),
Publisher: to.Ptr("RedHat"),
SKU: to.Ptr("8.2"),
Version: to.Ptr("8.2.2021091201"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("azureuser"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("{{privateKey}}"),
PublicKey: to.Ptr("{{sshkey}}"),
},
},
},
VMSize: to.Ptr("Standard_M32ts"),
},
},
NetworkConfiguration: &armworkloads.NetworkConfiguration{
IsSecondaryIPEnabled: to.Ptr(true),
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("sap.bpaas.com"),
},
SoftwareConfiguration: &armworkloads.SAPInstallWithoutOSConfigSoftwareConfiguration{
SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig),
BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"),
SapBitsStorageAccountID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"),
SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("microsoft.workloads/sapvirtualinstances"),
// ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/aa-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.240Z"); return t}()),
// CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.194Z"); return t}()),
// LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeApplication),
// },
// Location: to.Ptr("eastus2"),
// Tags: map[string]*string{
// "created by": to.Ptr("azureuser"),
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("aa-rg"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP-HA"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("azureuser"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E4ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP-HA"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("azureuser"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E4ds_v4"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP-HA"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("azureuser"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"),
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// NetworkConfiguration: &armworkloads.NetworkConfiguration{
// IsSecondaryIPEnabled: to.Ptr(true),
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("sap.bpaas.com"),
// },
// SoftwareConfiguration: &armworkloads.SAPInstallWithoutOSConfigSoftwareConfiguration{
// SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig),
// BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"),
// SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"),
// SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationInProgress),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Install_Distributed.json
*/
async function installSapSoftwareOnDistributedSystem() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "{{resourcegrp}}",
applicationServer: {
instanceCount: 2,
subnetId:
"/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP-HA",
publisher: "RedHat",
sku: "8.2",
version: "8.2.2021091201",
},
osProfile: {
adminUsername: "azureuser",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: {
privateKey: "{{privateKey}}",
publicKey: "{{sshkey}}",
},
},
},
vmSize: "Standard_E4ds_v4",
},
},
centralServer: {
instanceCount: 1,
subnetId:
"/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP-HA",
publisher: "RedHat",
sku: "8.2",
version: "8.2.2021091201",
},
osProfile: {
adminUsername: "azureuser",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: {
privateKey: "{{privateKey}}",
publicKey: "{{sshkey}}",
},
},
},
vmSize: "Standard_E4ds_v4",
},
},
databaseServer: {
instanceCount: 1,
subnetId:
"/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
virtualMachineConfiguration: {
imageReference: {
offer: "RHEL-SAP-HA",
publisher: "RedHat",
sku: "8.2",
version: "8.2.2021091201",
},
osProfile: {
adminUsername: "azureuser",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: {
privateKey: "{{privateKey}}",
publicKey: "{{sshkey}}",
},
},
},
vmSize: "Standard_M32ts",
},
},
deploymentType: "ThreeTier",
networkConfiguration: { isSecondaryIpEnabled: true },
},
osSapConfiguration: { sapFqdn: "sap.bpaas.com" },
softwareConfiguration: {
bomUrl:
"https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml",
sapBitsStorageAccountId:
"/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount",
softwareInstallationType: "SAPInstallWithoutOSConfig",
softwareVersion: "SAP S/4HANA 1909 SPS 03",
},
},
environment: "Prod",
location: "eastus2",
sapProduct: "S4HANA",
tags: { createdBy: "azureuser" },
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Install_Distributed.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("eastus2"), SapEnvironmentType.Prod, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new ThreeTierConfiguration("{{resourcegrp}}", new CentralServerConfiguration(new ResourceIdentifier("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), new SapVirtualMachineConfiguration("Standard_E4ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP-HA",
Sku = "8.2",
Version = "8.2.2021091201",
}, new SapOSProfile
{
AdminUsername = "azureuser",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "{{sshkey}}",
PrivateKey = "{{privateKey}}",
},
},
}), 1L), new ApplicationServerConfiguration(new ResourceIdentifier("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), new SapVirtualMachineConfiguration("Standard_E4ds_v4", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP-HA",
Sku = "8.2",
Version = "8.2.2021091201",
}, new SapOSProfile
{
AdminUsername = "azureuser",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "{{sshkey}}",
PrivateKey = "{{privateKey}}",
},
},
}), 2L), new DatabaseConfiguration(new ResourceIdentifier("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"), new SapVirtualMachineConfiguration("Standard_M32ts", new SapImageReference
{
Publisher = "RedHat",
Offer = "RHEL-SAP-HA",
Sku = "8.2",
Version = "8.2.2021091201",
}, new SapOSProfile
{
AdminUsername = "azureuser",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "{{sshkey}}",
PrivateKey = "{{privateKey}}",
},
},
}), 1L))
{
IsSecondaryIPEnabled = true,
},
SoftwareConfiguration = new SapInstallWithoutOSConfigSoftwareConfiguration(new Uri("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount", "SAP S/4HANA 1909 SPS 03"),
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "sap.bpaas.com",
},
})
{
Tags =
{
["created by"] = "azureuser"
},
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/aa-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "microsoft.workloads/sapvirtualinstances",
"location": "eastus2",
"tags": {
"created by": "azureuser"
},
"systemData": {
"createdBy": "f1bc9460-9d57-4c16-99a8-5a19378a3a93",
"createdByType": "Application",
"createdAt": "2022-08-18T18:25:55.2406546Z",
"lastModifiedBy": "f1bc9460-9d57-4c16-99a8-5a19378a3a93",
"lastModifiedByType": "Application",
"lastModifiedAt": "2022-08-18T18:50:59.1945444Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_E4ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_E4ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 2
},
"databaseServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 1
},
"appResourceGroup": "aa-rg"
},
"softwareConfiguration": {
"softwareInstallationType": "SAPInstallWithoutOSConfig",
"bomUrl": "https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml",
"softwareVersion": "SAP S/4HANA 1909 SPS 03",
"sapBitsStorageAccountId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"
},
"osSapConfiguration": {
"sapFqdn": "sap.bpaas.com"
}
},
"state": "SoftwareInstallationInProgress",
"provisioningState": "Accepted"
}
}
{
"id": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/aa-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "microsoft.workloads/sapvirtualinstances",
"location": "eastus2",
"tags": {
"created by": "azureuser"
},
"systemData": {
"createdBy": "f1bc9460-9d57-4c16-99a8-5a19378a3a93",
"createdByType": "Application",
"createdAt": "2022-08-18T18:25:55.2406546Z",
"lastModifiedBy": "f1bc9460-9d57-4c16-99a8-5a19378a3a93",
"lastModifiedByType": "Application",
"lastModifiedAt": "2022-08-18T18:50:59.1945444Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_E4ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_E4ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 2
},
"databaseServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 1
},
"appResourceGroup": "aa-rg"
},
"softwareConfiguration": {
"softwareInstallationType": "SAPInstallWithoutOSConfig",
"bomUrl": "https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml",
"softwareVersion": "SAP S/4HANA 1909 SPS 03",
"sapBitsStorageAccountId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"
},
"osSapConfiguration": {
"sapFqdn": "sap.bpaas.com"
}
},
"state": "SoftwareInstallationInProgress",
"provisioningState": "Accepted"
}
}
Install SAP Software on Single Server System
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"tags": {},
"location": "eastus2",
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "SingleServer",
"appResourceGroup": "test-rg",
"subnetId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/testsubnet",
"virtualMachineConfiguration": {
"vmSize": "Standard_E32ds_v4",
"imageReference": {
"offer": "SLES-SAP",
"publisher": "SUSE",
"sku": "12-sp4-gen2",
"version": "2022.02.01"
},
"osProfile": {
"adminUsername": "azureappadmin",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "{{sshkey}}",
"privateKey": "{{privateKey}}"
}
}
}
}
},
"softwareConfiguration": {
"softwareInstallationType": "SAPInstallWithoutOSConfig",
"bomUrl": "https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml",
"softwareVersion": "SAP S/4HANA 1909 SPS 03",
"sapBitsStorageAccountId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"
},
"osSapConfiguration": {
"sapFqdn": "sap.bpaas.com"
}
}
}
}
import com.azure.resourcemanager.workloads.models.DeploymentWithOSConfiguration;
import com.azure.resourcemanager.workloads.models.ImageReference;
import com.azure.resourcemanager.workloads.models.LinuxConfiguration;
import com.azure.resourcemanager.workloads.models.OSProfile;
import com.azure.resourcemanager.workloads.models.OsSapConfiguration;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapInstallWithoutOSConfigSoftwareConfiguration;
import com.azure.resourcemanager.workloads.models.SapProductType;
import com.azure.resourcemanager.workloads.models.SingleServerConfiguration;
import com.azure.resourcemanager.workloads.models.SshKeyPair;
import com.azure.resourcemanager.workloads.models.VirtualMachineConfiguration;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Install_SingleServer.json
*/
/**
* Sample code: Install SAP Software on Single Server System.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void
installSAPSoftwareOnSingleServerSystem(com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("eastus2").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.NON_PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DeploymentWithOSConfiguration().withAppLocation("eastus")
.withInfrastructureConfiguration(new SingleServerConfiguration().withAppResourceGroup("test-rg")
.withSubnetId(
"/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/testsubnet")
.withVirtualMachineConfiguration(new VirtualMachineConfiguration().withVmSize("Standard_E32ds_v4")
.withImageReference(new ImageReference().withPublisher("SUSE").withOffer("SLES-SAP")
.withSku("12-sp4-gen2").withVersion("2022.02.01"))
.withOsProfile(new OSProfile().withAdminUsername("azureappadmin")
.withOsConfiguration(new LinuxConfiguration().withDisablePasswordAuthentication(true)
.withSshKeyPair(new SshKeyPair().withPublicKey("fakeTokenPlaceholder")
.withPrivateKey("fakeTokenPlaceholder"))))))
.withSoftwareConfiguration(new SapInstallWithoutOSConfigSoftwareConfiguration().withBomUrl(
"https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml")
.withSapBitsStorageAccountId(
"/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount")
.withSoftwareVersion("SAP S/4HANA 1909 SPS 03"))
.withOsSapConfiguration(new OsSapConfiguration().withSapFqdn("sap.bpaas.com")))
.withTags(mapOf()).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_install_single_server.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Install_SingleServer.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Install_SingleServer.json
func ExampleSAPVirtualInstancesClient_BeginCreate_installSapSoftwareOnSingleServerSystem() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("eastus2"),
Tags: map[string]*string{},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DeploymentWithOSConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
AppLocation: to.Ptr("eastus"),
InfrastructureConfiguration: &armworkloads.SingleServerConfiguration{
AppResourceGroup: to.Ptr("test-rg"),
DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeSingleServer),
SubnetID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/testsubnet"),
VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
ImageReference: &armworkloads.ImageReference{
Offer: to.Ptr("SLES-SAP"),
Publisher: to.Ptr("SUSE"),
SKU: to.Ptr("12-sp4-gen2"),
Version: to.Ptr("2022.02.01"),
},
OSProfile: &armworkloads.OSProfile{
AdminUsername: to.Ptr("azureappadmin"),
OSConfiguration: &armworkloads.LinuxConfiguration{
OSType: to.Ptr(armworkloads.OSTypeLinux),
DisablePasswordAuthentication: to.Ptr(true),
SSHKeyPair: &armworkloads.SSHKeyPair{
PrivateKey: to.Ptr("{{privateKey}}"),
PublicKey: to.Ptr("{{sshkey}}"),
},
},
},
VMSize: to.Ptr("Standard_E32ds_v4"),
},
},
OSSapConfiguration: &armworkloads.OsSapConfiguration{
SapFqdn: to.Ptr("sap.bpaas.com"),
},
SoftwareConfiguration: &armworkloads.SAPInstallWithoutOSConfigSoftwareConfiguration{
SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig),
BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"),
SapBitsStorageAccountID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"),
SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"),
},
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("X00"),
// Type: to.Ptr("microsoft.workloads/sapvirtualinstances"),
// ID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/aa-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:25:55.240Z"); return t}()),
// CreatedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeApplication),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-08-18T18:50:59.194Z"); return t}()),
// LastModifiedBy: to.Ptr("f1bc9460-9d57-4c16-99a8-5a19378a3a93"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeApplication),
// },
// Location: to.Ptr("eastus2"),
// Tags: map[string]*string{
// "created by": to.Ptr("azureuser"),
// },
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DeploymentWithOSConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDeploymentWithOSConfig),
// AppLocation: to.Ptr("eastus"),
// InfrastructureConfiguration: &armworkloads.ThreeTierConfiguration{
// AppResourceGroup: to.Ptr("aa-rg"),
// DeploymentType: to.Ptr(armworkloads.SAPDeploymentTypeThreeTier),
// ApplicationServer: &armworkloads.ApplicationServerConfiguration{
// InstanceCount: to.Ptr[int64](2),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP-HA"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("azureuser"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E4ds_v4"),
// },
// },
// CentralServer: &armworkloads.CentralServerConfiguration{
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP-HA"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("azureuser"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"),
// },
// },
// },
// VMSize: to.Ptr("Standard_E4ds_v4"),
// },
// },
// DatabaseServer: &armworkloads.DatabaseConfiguration{
// InstanceCount: to.Ptr[int64](1),
// SubnetID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app"),
// VirtualMachineConfiguration: &armworkloads.VirtualMachineConfiguration{
// ImageReference: &armworkloads.ImageReference{
// Offer: to.Ptr("RHEL-SAP-HA"),
// Publisher: to.Ptr("RedHat"),
// SKU: to.Ptr("84sapha-gen2"),
// Version: to.Ptr("latest"),
// },
// OSProfile: &armworkloads.OSProfile{
// AdminUsername: to.Ptr("azureuser"),
// OSConfiguration: &armworkloads.LinuxConfiguration{
// OSType: to.Ptr(armworkloads.OSTypeLinux),
// DisablePasswordAuthentication: to.Ptr(true),
// SSHKeyPair: &armworkloads.SSHKeyPair{
// PublicKey: to.Ptr("ssh-rsa AAA generated-by-azure"),
// },
// },
// },
// VMSize: to.Ptr("Standard_M32ts"),
// },
// },
// NetworkConfiguration: &armworkloads.NetworkConfiguration{
// IsSecondaryIPEnabled: to.Ptr(true),
// },
// },
// OSSapConfiguration: &armworkloads.OsSapConfiguration{
// SapFqdn: to.Ptr("sap.bpaas.com"),
// },
// SoftwareConfiguration: &armworkloads.SAPInstallWithoutOSConfigSoftwareConfiguration{
// SoftwareInstallationType: to.Ptr(armworkloads.SAPSoftwareInstallationTypeSAPInstallWithoutOSConfig),
// BomURL: to.Ptr("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"),
// SapBitsStorageAccountID: to.Ptr("/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"),
// SoftwareVersion: to.Ptr("SAP S/4HANA 1909 SPS 03"),
// },
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeProd),
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateSoftwareInstallationInProgress),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Install_SingleServer.json
*/
async function installSapSoftwareOnSingleServerSystem() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
appLocation: "eastus",
configurationType: "DeploymentWithOSConfig",
infrastructureConfiguration: {
appResourceGroup: "test-rg",
deploymentType: "SingleServer",
subnetId:
"/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/testsubnet",
virtualMachineConfiguration: {
imageReference: {
offer: "SLES-SAP",
publisher: "SUSE",
sku: "12-sp4-gen2",
version: "2022.02.01",
},
osProfile: {
adminUsername: "azureappadmin",
osConfiguration: {
disablePasswordAuthentication: true,
osType: "Linux",
sshKeyPair: {
privateKey: "{{privateKey}}",
publicKey: "{{sshkey}}",
},
},
},
vmSize: "Standard_E32ds_v4",
},
},
osSapConfiguration: { sapFqdn: "sap.bpaas.com" },
softwareConfiguration: {
bomUrl:
"https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml",
sapBitsStorageAccountId:
"/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount",
softwareInstallationType: "SAPInstallWithoutOSConfig",
softwareVersion: "SAP S/4HANA 1909 SPS 03",
},
},
environment: "NonProd",
location: "eastus2",
sapProduct: "S4HANA",
tags: {},
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Install_SingleServer.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("eastus2"), SapEnvironmentType.NonProd, SapProductType.S4Hana, new DeploymentWithOSConfiguration
{
AppLocation = new AzureLocation("eastus"),
InfrastructureConfiguration = new SingleServerConfiguration("test-rg", new ResourceIdentifier("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/testsubnet"), new SapVirtualMachineConfiguration("Standard_E32ds_v4", new SapImageReference
{
Publisher = "SUSE",
Offer = "SLES-SAP",
Sku = "12-sp4-gen2",
Version = "2022.02.01",
}, new SapOSProfile
{
AdminUsername = "azureappadmin",
OSConfiguration = new SapLinuxConfiguration
{
DisablePasswordAuthentication = true,
SshKeyPair = new SapSshKeyPair
{
PublicKey = "{{sshkey}}",
PrivateKey = "{{privateKey}}",
},
},
})),
SoftwareConfiguration = new SapInstallWithoutOSConfigSoftwareConfiguration(new Uri("https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml"), "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount", "SAP S/4HANA 1909 SPS 03"),
OSSapConfiguration = new OSSapConfiguration
{
SapFqdn = "sap.bpaas.com",
},
})
{
Tags = { },
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/aa-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "microsoft.workloads/sapvirtualinstances",
"location": "eastus2",
"tags": {
"created by": "azureuser"
},
"systemData": {
"createdBy": "f1bc9460-9d57-4c16-99a8-5a19378a3a93",
"createdByType": "Application",
"createdAt": "2022-08-18T18:25:55.2406546Z",
"lastModifiedBy": "f1bc9460-9d57-4c16-99a8-5a19378a3a93",
"lastModifiedByType": "Application",
"lastModifiedAt": "2022-08-18T18:50:59.1945444Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_E4ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_E4ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 2
},
"databaseServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 1
},
"appResourceGroup": "aa-rg"
},
"softwareConfiguration": {
"softwareInstallationType": "SAPInstallWithoutOSConfig",
"bomUrl": "https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml",
"softwareVersion": "SAP S/4HANA 1909 SPS 03",
"sapBitsStorageAccountId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"
},
"osSapConfiguration": {
"sapFqdn": "sap.bpaas.com"
}
},
"state": "SoftwareInstallationInProgress",
"provisioningState": "Accepted"
}
}
{
"id": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/aa-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00",
"name": "X00",
"type": "microsoft.workloads/sapvirtualinstances",
"location": "eastus2",
"tags": {
"created by": "azureuser"
},
"systemData": {
"createdBy": "f1bc9460-9d57-4c16-99a8-5a19378a3a93",
"createdByType": "Application",
"createdAt": "2022-08-18T18:25:55.2406546Z",
"lastModifiedBy": "f1bc9460-9d57-4c16-99a8-5a19378a3a93",
"lastModifiedByType": "Application",
"lastModifiedAt": "2022-08-18T18:50:59.1945444Z"
},
"properties": {
"environment": "Prod",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "DeploymentWithOSConfig",
"appLocation": "eastus",
"infrastructureConfiguration": {
"deploymentType": "ThreeTier",
"networkConfiguration": {
"isSecondaryIpEnabled": true
},
"centralServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_E4ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 1
},
"applicationServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_E4ds_v4",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 2
},
"databaseServer": {
"subnetId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/app",
"virtualMachineConfiguration": {
"vmSize": "Standard_M32ts",
"imageReference": {
"sku": "84sapha-gen2",
"publisher": "RedHat",
"version": "latest",
"offer": "RHEL-SAP-HA"
},
"osProfile": {
"adminUsername": "azureuser",
"osConfiguration": {
"osType": "Linux",
"disablePasswordAuthentication": true,
"sshKeyPair": {
"publicKey": "ssh-rsa AAA generated-by-azure"
}
}
}
},
"instanceCount": 1
},
"appResourceGroup": "aa-rg"
},
"softwareConfiguration": {
"softwareInstallationType": "SAPInstallWithoutOSConfig",
"bomUrl": "https://teststorageaccount.blob.core.windows.net/sapbits/sapfiles/boms/S41909SPS03_v0011ms/S41909SPS03_v0011ms.yaml",
"softwareVersion": "SAP S/4HANA 1909 SPS 03",
"sapBitsStorageAccountId": "/subscriptions/49d64d54-e966-4c46-a868-1999802b762c/resourceGroups/test-rg/providers/Microsoft.Storage/storageAccounts/teststorageaccount"
},
"osSapConfiguration": {
"sapFqdn": "sap.bpaas.com"
}
},
"state": "SoftwareInstallationInProgress",
"provisioningState": "Accepted"
}
}
Register existing SAP system as Virtual Instance for SAP solutions with optional customizations.
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Discovery",
"centralServerVmId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0",
"managedRgStorageAccountName": "q20saacssgrs"
}
},
"location": "northeurope",
"tags": {
"test": "abc",
"createdby": "abc@microsoft.com"
}
}
import com.azure.resourcemanager.workloads.models.DiscoveryConfiguration;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_Discover_CustomMrgStorageAccountName.json
*/
/**
* Sample code: Register existing SAP system as Virtual Instance for SAP solutions with optional customizations.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void registerExistingSAPSystemAsVirtualInstanceForSAPSolutionsWithOptionalCustomizations(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("northeurope").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.NON_PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DiscoveryConfiguration().withCentralServerVmId(
"/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0")
.withManagedRgStorageAccountName("q20saacssgrs"))
.withTags(mapOf("createdby", "abc@microsoft.com", "test", "abc")).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_discover_custom_mrg_storage_account_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 = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover_CustomMrgStorageAccountName.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover_CustomMrgStorageAccountName.json
func ExampleSAPVirtualInstancesClient_BeginCreate_registerExistingSapSystemAsVirtualInstanceForSapSolutionsWithOptionalCustomizations() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("northeurope"),
Tags: map[string]*string{
"createdby": to.Ptr("abc@microsoft.com"),
"test": to.Ptr("abc"),
},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DiscoveryConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDiscovery),
CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"),
ManagedRgStorageAccountName: to.Ptr("q20saacssgrs"),
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("Q20"),
// Type: to.Ptr("microsoft.workloads/sapvirtualinstances"),
// ID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T08:22:52.331Z"); return t}()),
// CreatedBy: to.Ptr("abc@microsoft.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T11:44:17.931Z"); return t}()),
// LastModifiedBy: to.Ptr("abc@microsoft.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("northeurope"),
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DiscoveryConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDiscovery),
// AppLocation: to.Ptr("westeurope"),
// CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0"),
// ManagedRgStorageAccountName: to.Ptr("q20saacssgrs"),
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd),
// Health: to.Ptr(armworkloads.SAPHealthStateHealthy),
// ManagedResourceGroupConfiguration: &armworkloads.ManagedRGConfiguration{
// Name: to.Ptr("mrg-Q20-5b0097"),
// },
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateRegistrationComplete),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover_CustomMrgStorageAccountName.json
*/
async function registerExistingSapSystemAsVirtualInstanceForSapSolutionsWithOptionalCustomizations() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
centralServerVmId:
"/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0",
configurationType: "Discovery",
managedRgStorageAccountName: "q20saacssgrs",
},
environment: "NonProd",
location: "northeurope",
sapProduct: "S4HANA",
tags: { createdby: "abc@microsoft.com", test: "abc" },
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover_CustomMrgStorageAccountName.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("northeurope"), SapEnvironmentType.NonProd, SapProductType.S4Hana, new DiscoveryConfiguration
{
CentralServerVmId = new ResourceIdentifier("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"),
ManagedRgStorageAccountName = "q20saacssgrs",
})
{
Tags =
{
["createdby"] = "abc@microsoft.com",
["test"] = "abc"
},
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20",
"name": "Q20",
"type": "microsoft.workloads/sapvirtualinstances",
"location": "northeurope",
"systemData": {
"createdBy": "abc@microsoft.com",
"createdByType": "User",
"createdAt": "2022-07-27T08:22:52.3318907Z",
"lastModifiedBy": "abc@microsoft.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2022-07-27T11:44:17.9310503Z"
},
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Discovery",
"centralServerVmId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0",
"managedRgStorageAccountName": "q20saacssgrs",
"appLocation": "westeurope"
},
"state": "RegistrationComplete",
"provisioningState": "Succeeded",
"managedResourceGroupConfiguration": {
"name": "mrg-Q20-5b0097"
},
"status": "Running",
"health": "Healthy"
}
}
{
"id": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20",
"name": "Q20",
"type": "microsoft.workloads/sapvirtualinstances",
"location": "northeurope",
"systemData": {
"createdBy": "abc@microsoft.com",
"createdByType": "User",
"createdAt": "2022-07-27T08:22:52.3318907Z",
"lastModifiedBy": "abc@microsoft.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2022-07-27T11:44:17.9310503Z"
},
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Discovery",
"centralServerVmId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0",
"managedRgStorageAccountName": "q20saacssgrs"
},
"state": "RegistrationComplete",
"provisioningState": "Succeeded",
"managedResourceGroupConfiguration": {
"name": "mrg-Q20-5b0097"
},
"status": "Running",
"health": "Healthy"
}
}
Register existing SAP system as Virtual Instance for SAP solutions.
Sample request
PUT https://management.azure.com/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/X00?api-version=2023-04-01
{
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Discovery",
"centralServerVmId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"
}
},
"location": "northeurope",
"tags": {
"test": "abc",
"createdby": "abc@microsoft.com"
}
}
import com.azure.resourcemanager.workloads.models.DiscoveryConfiguration;
import com.azure.resourcemanager.workloads.models.SapEnvironmentType;
import com.azure.resourcemanager.workloads.models.SapProductType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for SapVirtualInstances Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/
* SAPVirtualInstances_Create_Discover.json
*/
/**
* Sample code: Register existing SAP system as Virtual Instance for SAP solutions.
*
* @param manager Entry point to WorkloadsManager.
*/
public static void registerExistingSAPSystemAsVirtualInstanceForSAPSolutions(
com.azure.resourcemanager.workloads.WorkloadsManager manager) {
manager.sapVirtualInstances().define("X00").withRegion("northeurope").withExistingResourceGroup("test-rg")
.withEnvironment(SapEnvironmentType.NON_PROD).withSapProduct(SapProductType.S4HANA)
.withConfiguration(new DiscoveryConfiguration().withCentralServerVmId(
"/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"))
.withTags(mapOf("createdby", "abc@microsoft.com", "test", "abc")).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.workloads import WorkloadsMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-workloads
# USAGE
python sap_virtual_instances_create_discover.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = WorkloadsMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="8e17e36c-42e9-4cd5-a078-7b44883414e0",
)
response = client.sap_virtual_instances.begin_create(
resource_group_name="test-rg",
sap_virtual_instance_name="X00",
).result()
print(response)
# x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armworkloads_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/armworkloads"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1e7b408f3323e7f5424745718fe62c7a043a2337/specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover.json
func ExampleSAPVirtualInstancesClient_BeginCreate_registerExistingSapSystemAsVirtualInstanceForSapSolutions() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armworkloads.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewSAPVirtualInstancesClient().BeginCreate(ctx, "test-rg", "X00", armworkloads.SAPVirtualInstance{
Location: to.Ptr("northeurope"),
Tags: map[string]*string{
"createdby": to.Ptr("abc@microsoft.com"),
"test": to.Ptr("abc"),
},
Properties: &armworkloads.SAPVirtualInstanceProperties{
Configuration: &armworkloads.DiscoveryConfiguration{
ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDiscovery),
CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"),
},
Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd),
SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.SAPVirtualInstance = armworkloads.SAPVirtualInstance{
// Name: to.Ptr("Q20"),
// Type: to.Ptr("microsoft.workloads/sapvirtualinstances"),
// ID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20"),
// SystemData: &armworkloads.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T08:22:52.331Z"); return t}()),
// CreatedBy: to.Ptr("abc@microsoft.com"),
// CreatedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-27T11:44:17.931Z"); return t}()),
// LastModifiedBy: to.Ptr("abc@microsoft.com"),
// LastModifiedByType: to.Ptr(armworkloads.CreatedByTypeUser),
// },
// Location: to.Ptr("northeurope"),
// Properties: &armworkloads.SAPVirtualInstanceProperties{
// Configuration: &armworkloads.DiscoveryConfiguration{
// ConfigurationType: to.Ptr(armworkloads.SAPConfigurationTypeDiscovery),
// AppLocation: to.Ptr("westeurope"),
// CentralServerVMID: to.Ptr("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0"),
// },
// Environment: to.Ptr(armworkloads.SAPEnvironmentTypeNonProd),
// Health: to.Ptr(armworkloads.SAPHealthStateHealthy),
// ManagedResourceGroupConfiguration: &armworkloads.ManagedRGConfiguration{
// Name: to.Ptr("mrg-Q20-5b0097"),
// },
// ProvisioningState: to.Ptr(armworkloads.SapVirtualInstanceProvisioningStateSucceeded),
// SapProduct: to.Ptr(armworkloads.SAPProductTypeS4HANA),
// State: to.Ptr(armworkloads.SAPVirtualInstanceStateRegistrationComplete),
// Status: to.Ptr(armworkloads.SAPVirtualInstanceStatusRunning),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { WorkloadsClient } = require("@azure/arm-workloads");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a Virtual Instance for SAP solutions (VIS) resource
*
* @summary Creates a Virtual Instance for SAP solutions (VIS) resource
* x-ms-original-file: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover.json
*/
async function registerExistingSapSystemAsVirtualInstanceForSapSolutions() {
const subscriptionId =
process.env["WORKLOADS_SUBSCRIPTION_ID"] || "8e17e36c-42e9-4cd5-a078-7b44883414e0";
const resourceGroupName = process.env["WORKLOADS_RESOURCE_GROUP"] || "test-rg";
const sapVirtualInstanceName = "X00";
const body = {
configuration: {
centralServerVmId:
"/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0",
configurationType: "Discovery",
},
environment: "NonProd",
location: "northeurope",
sapProduct: "S4HANA",
tags: { createdby: "abc@microsoft.com", test: "abc" },
};
const options = { body };
const credential = new DefaultAzureCredential();
const client = new WorkloadsClient(credential, subscriptionId);
const result = await client.sAPVirtualInstances.beginCreateAndWait(
resourceGroupName,
sapVirtualInstanceName,
options
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Workloads.Models;
using Azure.ResourceManager.Workloads;
// Generated from example definition: specification/workloads/resource-manager/Microsoft.Workloads/stable/2023-04-01/examples/sapvirtualinstances/SAPVirtualInstances_Create_Discover.json
// this example is just showing the usage of "SAPVirtualInstances_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "8e17e36c-42e9-4cd5-a078-7b44883414e0";
string resourceGroupName = "test-rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SapVirtualInstanceResource
SapVirtualInstanceCollection collection = resourceGroupResource.GetSapVirtualInstances();
// invoke the operation
string sapVirtualInstanceName = "X00";
SapVirtualInstanceData data = new SapVirtualInstanceData(new AzureLocation("northeurope"), SapEnvironmentType.NonProd, SapProductType.S4Hana, new DiscoveryConfiguration
{
CentralServerVmId = new ResourceIdentifier("/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Compute/virtualMachines/sapq20scsvm0"),
})
{
Tags =
{
["createdby"] = "abc@microsoft.com",
["test"] = "abc"
},
};
ArmOperation<SapVirtualInstanceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sapVirtualInstanceName, data);
SapVirtualInstanceResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SapVirtualInstanceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20",
"name": "Q20",
"type": "microsoft.workloads/sapvirtualinstances",
"location": "northeurope",
"systemData": {
"createdBy": "abc@microsoft.com",
"createdByType": "User",
"createdAt": "2022-07-27T08:22:52.3318907Z",
"lastModifiedBy": "abc@microsoft.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2022-07-27T11:44:17.9310503Z"
},
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Discovery",
"centralServerVmId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0",
"appLocation": "westeurope"
},
"state": "RegistrationComplete",
"provisioningState": "Succeeded",
"managedResourceGroupConfiguration": {
"name": "mrg-Q20-5b0097"
},
"status": "Running",
"health": "Healthy"
}
}
{
"id": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg/providers/Microsoft.Workloads/sapVirtualInstances/Q20",
"name": "Q20",
"type": "microsoft.workloads/sapvirtualinstances",
"location": "northeurope",
"systemData": {
"createdBy": "abc@microsoft.com",
"createdByType": "User",
"createdAt": "2022-07-27T08:22:52.3318907Z",
"lastModifiedBy": "abc@microsoft.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2022-07-27T11:44:17.9310503Z"
},
"properties": {
"environment": "NonProd",
"sapProduct": "S4HANA",
"configuration": {
"configurationType": "Discovery",
"centralServerVmId": "/subscriptions/8e17e36c-42e9-4cd5-a078-7b44883414e0/resourceGroups/test-rg-infra/providers/Microsoft.Compute/virtualMachines/q20ascsvm0",
"appLocation": "westeurope"
},
"state": "RegistrationComplete",
"provisioningState": "Succeeded",
"managedResourceGroupConfiguration": {
"name": "mrg-Q20-5b0097"
},
"status": "Running",
"health": "Healthy"
}
}
Definitions
| Name |
Description |
|
ApplicationServerConfiguration
|
Gets or sets the application server configuration.
|
|
ApplicationServerFullResourceNames
|
The full resource names object for application layer resources. The number of entries in this list should be equal to the number VMs to be created for application layer.
|
|
CentralServerConfiguration
|
Gets or sets the central server configuration.
|
|
CentralServerFullResourceNames
|
The full resource names object for central server layer resources.
|
|
CreateAndMountFileShareConfiguration
|
Gets or sets the file share configuration where the transport directory fileshare is created and mounted as a part of the create infra flow. Please pre-create the resource group you intend to place the transport directory in. The storage account and fileshare will be auto-created by the ACSS and doesn’t need to pre-created.
|
|
createdByType
|
The type of identity that created the resource.
|
|
DatabaseConfiguration
|
Gets or sets the database configuration.
|
|
DatabaseServerFullResourceNames
|
The full resource names object for database layer resources. The number of entries in this list should be equal to the number VMs to be created for database layer.
|
|
DeployerVmPackages
|
Defines the url and storage account ID where deployer VM packages are uploaded
|
|
DeploymentConfiguration
|
Deployment Configuration.
|
|
DeploymentWithOSConfiguration
|
Deployment along with OS Configuration.
|
|
DiscoveryConfiguration
|
Discovery Details.
|
|
DiskConfiguration
|
The Disk Configuration Details.
|
|
DiskSku
|
The type of disk sku. For example, Standard_LRS, Standard_ZRS, Premium_LRS, Premium_ZRS.
|
|
DiskSkuName
|
Defines the disk sku name.
|
|
DiskVolumeConfiguration
|
The disk configuration required for the selected volume.
|
|
ErrorAdditionalInfo
|
The resource management error additional info.
|
|
ErrorDefinition
|
Error definition.
|
|
ErrorDetail
|
The error detail.
|
|
ErrorResponse
|
Error response
|
|
ExternalInstallationSoftwareConfiguration
|
The SAP Software configuration Input when the software is installed externally outside the service.
|
|
HighAvailabilityConfiguration
|
Gets or sets the high availability configuration.
|
|
HighAvailabilitySoftwareConfiguration
|
Gets or sets the HA software configuration.
|
|
ImageReference
|
Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. NOTE: Image reference publisher and offer can only be set when you create the scale set.
|
|
LinuxConfiguration
|
Specifies the Linux operating system settings on the virtual machine.
For a list of supported Linux distributions, see Linux on Azure-Endorsed Distributions.
|
|
LoadBalancerResourceNames
|
The resource names object for load balancer and related resources.
|
|
ManagedRGConfiguration
|
Managed resource group configuration
|
|
ManagedServiceIdentityType
|
Type of managed service identity (only None, UserAssigned types are allowed).
|
|
MountFileShareConfiguration
|
Gets or sets the file share configuration where the transport directory fileshare already exists, and user wishes to mount the fileshare as a part of the create infra flow.
|
|
NamingPatternType
|
The pattern type to be used for resource naming.
|
|
NetworkConfiguration
|
Defines the network configuration type for SAP system infrastructure that is being deployed
|
|
NetworkInterfaceResourceNames
|
The resource names object for network interface and related resources.
|
|
OSProfile
|
Specifies the operating system settings for the virtual machine. Some of the settings cannot be changed once VM is provisioned.
|
|
OsSapConfiguration
|
Defines the OS and SAP Configurations for Deployment
|
|
SAPDatabaseType
|
Defines the supported SAP Database types.
|
|
SAPDeploymentType
|
The deployment type. Eg: SingleServer/ThreeTier
|
|
SAPEnvironmentType
|
Defines the environment type - Production/Non Production.
|
|
SAPHealthState
|
Defines the health of SAP Instances.
|
|
SAPHighAvailabilityType
|
The high availability type.
|
|
SAPInstallWithoutOSConfigSoftwareConfiguration
|
The SAP Software configuration Input when the software is to be installed by service without OS Configurations
|
|
SAPProductType
|
Defines the SAP Product type.
|
|
SAPSoftwareInstallationType
|
The SAP software installation Type.
|
|
SAPVirtualInstance
|
Define the Virtual Instance for SAP solutions resource.
|
|
SAPVirtualInstanceError
|
An error response from the Virtual Instance for SAP Workload service.
|
|
SapVirtualInstanceProvisioningState
|
Defines the provisioning states.
|
|
SAPVirtualInstanceState
|
Defines the Virtual Instance for SAP state.
|
|
SAPVirtualInstanceStatus
|
Defines the SAP Instance status.
|
|
ServiceInitiatedSoftwareConfiguration
|
The SAP Software configuration Input when the software is to be installed by service.
|
|
sharedStorageResourceNames
|
The resource names object for shared storage.
|
|
SingleServerConfiguration
|
Gets or sets the single server configuration. For prerequisites for creating the infrastructure, please see here
|
|
SingleServerFullResourceNames
|
The resource name object where the specified values will be full resource names of the corresponding resources in a single server SAP system.
|
|
SkipFileShareConfiguration
|
Gets or sets the file share configuration for scenarios where transport directory fileshare is not created or required.
|
|
SshConfiguration
|
SSH configuration for Linux based VMs running on Azure
|
|
SshKeyPair
|
The SSH Key-pair used to authenticate with the VM. The key needs to be at least 2048-bit and in ssh-rsa format.
For creating ssh keys, see Create SSH keys on Linux and Mac for Linux VMs in Azure.
|
|
SshPublicKey
|
Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed.
|
|
StorageConfiguration
|
Gets or sets the storage configuration.
|
|
systemData
|
Metadata pertaining to creation and last modification of the resource.
|
|
ThreeTierConfiguration
|
Gets or sets the three tier SAP configuration. For prerequisites for creating the infrastructure, please see here
|
|
ThreeTierFullResourceNames
|
The resource name object where the specified values will be full resource names of the corresponding resources in a three tier SAP system.
|
|
UserAssignedIdentity
|
User assigned identity properties
|
|
UserAssignedServiceIdentity
|
A pre-created user assigned identity with appropriate roles assigned. To learn more on identity and roles required, visit the ACSS how-to-guide.
|
|
VirtualMachineConfiguration
|
Defines the virtual machine configuration.
|
|
VirtualMachineResourceNames
|
The resource names object for virtual machine and related resources.
|
|
WindowsConfiguration
|
Specifies Windows operating system settings on the virtual machine.
|
ApplicationServerConfiguration
Object
Gets or sets the application server configuration.
| Name |
Type |
Description |
|
instanceCount
|
integer
(int64)
|
The number of app server instances.
|
|
subnetId
|
string
|
The subnet id.
|
|
virtualMachineConfiguration
|
VirtualMachineConfiguration
|
Gets or sets the virtual machine configuration.
|
ApplicationServerFullResourceNames
Object
The full resource names object for application layer resources. The number of entries in this list should be equal to the number VMs to be created for application layer.
| Name |
Type |
Description |
|
availabilitySetName
|
string
|
The full name for availability set. In case name is not provided, it will be defaulted to {SID}-App-AvSet.
|
|
virtualMachines
|
VirtualMachineResourceNames[]
|
The list of virtual machine naming details.
|
CentralServerConfiguration
Object
Gets or sets the central server configuration.
| Name |
Type |
Description |
|
instanceCount
|
integer
(int64)
|
The number of central server VMs.
|
|
subnetId
|
string
|
The subnet id.
|
|
virtualMachineConfiguration
|
VirtualMachineConfiguration
|
Gets or sets the virtual machine configuration.
|
CentralServerFullResourceNames
Object
The full resource names object for central server layer resources.
| Name |
Type |
Description |
|
availabilitySetName
|
string
|
The full name for availability set. In case name is not provided, it will be defaulted to {SID}-ASCS-AvSet.
|
|
loadBalancer
|
LoadBalancerResourceNames
|
The resource names object for load balancer and related resources.
|
|
virtualMachines
|
VirtualMachineResourceNames[]
|
The list of names for all ASCS virtual machines to be deployed. The number of entries in this list should be equal to the number VMs to be created for ASCS layer. At maximum, there can be two virtual machines at this layer: ASCS and ERS.
|
CreateAndMountFileShareConfiguration
Object
Gets or sets the file share configuration where the transport directory fileshare is created and mounted as a part of the create infra flow. Please pre-create the resource group you intend to place the transport directory in. The storage account and fileshare will be auto-created by the ACSS and doesn’t need to pre-created.
| Name |
Type |
Description |
|
configurationType
|
string:
CreateAndMount
|
The type of file share config.
|
|
resourceGroup
|
string
|
The name of transport file share resource group. This should be pre created by the customer. The app rg is used in case of missing input.
|
|
storageAccountName
|
string
|
The name of file share storage account name . A custom name is used in case of missing input.
|
createdByType
Enumeration
The type of identity that created the resource.
| Value |
Description |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
DatabaseConfiguration
Object
Gets or sets the database configuration.
| Name |
Type |
Description |
|
databaseType
|
SAPDatabaseType
|
The database type.
|
|
diskConfiguration
|
DiskConfiguration
|
Gets or sets the disk configuration.
|
|
instanceCount
|
integer
(int64)
|
The number of database VMs.
|
|
subnetId
|
string
|
The subnet id.
|
|
virtualMachineConfiguration
|
VirtualMachineConfiguration
|
Gets or sets the virtual machine configuration.
|
DatabaseServerFullResourceNames
Object
The full resource names object for database layer resources. The number of entries in this list should be equal to the number VMs to be created for database layer.
| Name |
Type |
Description |
|
availabilitySetName
|
string
|
The full name for availability set. In case name is not provided, it will be defaulted to {SID}-DB-AvSet.
|
|
loadBalancer
|
LoadBalancerResourceNames
|
The resource names object for load balancer and related resources.
|
|
virtualMachines
|
VirtualMachineResourceNames[]
|
The list of virtual machine naming details.
|
DeployerVmPackages
Object
Defines the url and storage account ID where deployer VM packages are uploaded
| Name |
Type |
Description |
|
storageAccountId
|
string
|
The deployer VM packages storage account id
|
|
url
|
string
|
The URL to the deployer VM packages file.
|
DeploymentConfiguration
Object
Deployment Configuration.
| Name |
Type |
Description |
|
appLocation
|
string
|
The geo-location where the SAP system is to be created.
|
|
configurationType
|
string:
Deployment
|
The configuration Type.
|
|
infrastructureConfiguration
|
InfrastructureConfiguration:
|
The infrastructure configuration.
|
|
softwareConfiguration
|
SoftwareConfiguration:
|
The software configuration.
|
DeploymentWithOSConfiguration
Object
Deployment along with OS Configuration.
| Name |
Type |
Description |
|
appLocation
|
string
|
The geo-location where the SAP system is to be created.
|
|
configurationType
|
string:
DeploymentWithOSConfig
|
The configuration Type.
|
|
infrastructureConfiguration
|
InfrastructureConfiguration:
|
The infrastructure configuration.
|
|
osSapConfiguration
|
OsSapConfiguration
|
The OS and SAP configuration.
|
|
softwareConfiguration
|
SoftwareConfiguration:
|
The software configuration.
|
DiscoveryConfiguration
Object
Discovery Details.
| Name |
Type |
Description |
|
appLocation
|
string
|
The geo-location where the SAP system exists.
|
|
centralServerVmId
|
string
|
The virtual machine ID of the Central Server.
|
|
configurationType
|
string:
Discovery
|
The configuration Type.
|
|
managedRgStorageAccountName
|
string
minLength: 3 maxLength: 24
|
The custom storage account name for the storage account created by the service in the managed resource group created as part of VIS deployment.
Refer to the storage account naming rules here.
If not provided, the service will create the storage account with a random name.
|
DiskConfiguration
Object
The Disk Configuration Details.
| Name |
Type |
Description |
|
diskVolumeConfigurations
|
<string,
DiskVolumeConfiguration>
|
The disk configuration for the db volume. For HANA, Required volumes are: ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os'], Optional volume : ['backup'].
|
DiskSku
Object
The type of disk sku. For example, Standard_LRS, Standard_ZRS, Premium_LRS, Premium_ZRS.
| Name |
Type |
Description |
|
name
|
DiskSkuName
|
Defines the disk sku name.
|
DiskSkuName
Enumeration
Defines the disk sku name.
| Value |
Description |
|
Standard_LRS
|
|
|
Premium_LRS
|
|
|
StandardSSD_LRS
|
|
|
UltraSSD_LRS
|
|
|
Premium_ZRS
|
|
|
StandardSSD_ZRS
|
|
|
PremiumV2_LRS
|
|
DiskVolumeConfiguration
Object
The disk configuration required for the selected volume.
| Name |
Type |
Description |
|
count
|
integer
(int64)
|
The total number of disks required for the concerned volume.
|
|
sizeGB
|
integer
(int64)
|
The disk size in GB.
|
|
sku
|
DiskSku
|
The disk SKU details.
|
ErrorAdditionalInfo
Object
The resource management error additional info.
| Name |
Type |
Description |
|
info
|
object
|
The additional info.
|
|
type
|
string
|
The additional info type.
|
ErrorDefinition
Object
Error definition.
| Name |
Type |
Description |
|
code
|
string
|
Service specific error code which serves as the substatus for the HTTP error code.
|
|
details
|
ErrorDefinition[]
|
Internal error details.
|
|
message
|
string
|
Description of the error.
|
ErrorDetail
Object
The error detail.
| Name |
Type |
Description |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
The error additional info.
|
|
code
|
string
|
The error code.
|
|
details
|
ErrorDetail[]
|
The error details.
|
|
message
|
string
|
The error message.
|
|
target
|
string
|
The error target.
|
ErrorResponse
Object
Error response
| Name |
Type |
Description |
|
error
|
ErrorDetail
|
The error object.
|
ExternalInstallationSoftwareConfiguration
Object
The SAP Software configuration Input when the software is installed externally outside the service.
| Name |
Type |
Description |
|
centralServerVmId
|
string
|
The resource ID of the virtual machine containing the central server instance.
|
|
softwareInstallationType
|
string:
External
|
The SAP software installation Type.
|
HighAvailabilityConfiguration
Object
Gets or sets the high availability configuration.
HighAvailabilitySoftwareConfiguration
Object
Gets or sets the HA software configuration.
| Name |
Type |
Description |
|
fencingClientId
|
string
|
The fencing client id.
|
|
fencingClientPassword
|
string
|
The fencing client id secret/password. The secret should never expire. This will be used pacemaker to start/stop the cluster VMs.
|
ImageReference
Object
Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. NOTE: Image reference publisher and offer can only be set when you create the scale set.
| Name |
Type |
Description |
|
offer
|
string
|
Specifies the offer of the platform image or marketplace image used to create the virtual machine.
|
|
publisher
|
string
|
The image publisher.
|
|
sku
|
string
|
The image SKU.
|
|
version
|
string
|
Specifies the version of the platform image or marketplace image used to create the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image will not automatically update after deploy time even if a new version becomes available.
|
LinuxConfiguration
Object
Specifies the Linux operating system settings on the virtual machine.
For a list of supported Linux distributions, see Linux on Azure-Endorsed Distributions.
| Name |
Type |
Description |
|
disablePasswordAuthentication
|
boolean
|
Specifies whether password authentication should be disabled.
|
|
osType
|
string:
Linux
|
The OS Type
|
|
ssh
|
SshConfiguration
|
Specifies the ssh key configuration for a Linux OS. (This property is deprecated, please use 'sshKeyPair' instead)
|
|
sshKeyPair
|
SshKeyPair
|
The SSH Key-pair used to authenticate with the VM's.
|
LoadBalancerResourceNames
Object
The resource names object for load balancer and related resources.
| Name |
Type |
Description |
|
backendPoolNames
|
string[]
|
The list of backend pool names. Currently, ACSS deploys only one backend pool and hence, size of this list should be 1
|
|
frontendIpConfigurationNames
|
string[]
|
The list of frontend IP configuration names. If provided as input, size of this list should be 2 for cs layer and should be 1 for database layer.
|
|
healthProbeNames
|
string[]
|
The list of health probe names. If provided as input, size of this list should be 2 for cs layer and should be 1 for database layer.
|
|
loadBalancerName
|
string
|
The full resource name for load balancer. If this value is not provided, load balancer will be name as {ASCS/DB}-loadBalancer.
|
ManagedRGConfiguration
Object
Managed resource group configuration
| Name |
Type |
Description |
|
name
|
string
|
Managed resource group name
|
ManagedServiceIdentityType
Enumeration
Type of managed service identity (only None, UserAssigned types are allowed).
| Value |
Description |
|
None
|
|
|
UserAssigned
|
|
MountFileShareConfiguration
Object
Gets or sets the file share configuration where the transport directory fileshare already exists, and user wishes to mount the fileshare as a part of the create infra flow.
| Name |
Type |
Description |
|
configurationType
|
string:
Mount
|
The type of file share config.
|
|
id
|
string
|
The fileshare resource ID
|
|
privateEndpointId
|
string
|
The private endpoint resource ID
|
NamingPatternType
Enumeration
The pattern type to be used for resource naming.
| Value |
Description |
|
FullResourceName
|
|
NetworkConfiguration
Object
Defines the network configuration type for SAP system infrastructure that is being deployed
| Name |
Type |
Default value |
Description |
|
isSecondaryIpEnabled
|
boolean
|
False
|
Specifies whether a secondary IP address should be added to the network interface on all VMs of the SAP system being deployed
|
NetworkInterfaceResourceNames
Object
The resource names object for network interface and related resources.
| Name |
Type |
Description |
|
networkInterfaceName
|
string
|
The full name for network interface. If name is not provided, service uses a default name based on the deployment type. For SingleServer, default name is {SID}-Nic. In case of HA-AvZone systems, default name will be {SID}-{App/ASCS/DB}-Zone{A/B}-Nic with an incrementor at the end in case of more than 1 instance per layer. For distributed and HA-AvSet systems, default name will be {SID}-{App/ASCS/DB}-Nic with an incrementor at the end in case of more than 1 instance per layer.
|
OSProfile
Object
Specifies the operating system settings for the virtual machine. Some of the settings cannot be changed once VM is provisioned.
| Name |
Type |
Description |
|
adminPassword
|
string
|
Specifies the password of the administrator account.
Minimum-length (Windows): 8 characters
Minimum-length (Linux): 6 characters
Max-length (Windows): 123 characters
Max-length (Linux): 72 characters
Complexity requirements: 3 out of 4 conditions below need to be fulfilled Has lower characters Has upper characters Has a digit Has a special character (Regex match [\W_])
Disallowed values: "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!"
For resetting the password, see How to reset the Remote Desktop service or its login password in a Windows VM
For resetting root password, see Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension
|
|
adminUsername
|
string
|
Specifies the name of the administrator account.
This property cannot be updated after the VM is created.
Windows-only restriction: Cannot end in "."
Disallowed values: "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5".
Minimum-length (Linux): 1 character
Max-length (Linux): 64 characters
Max-length (Windows): 20 characters.
|
|
osConfiguration
|
OSConfiguration:
|
Specifies Windows operating system settings on the virtual machine.
|
OsSapConfiguration
Object
Defines the OS and SAP Configurations for Deployment
| Name |
Type |
Description |
|
deployerVmPackages
|
DeployerVmPackages
|
The url and storage account ID where deployer VM packages are uploaded
|
|
sapFqdn
|
string
|
The FQDN to set for the SAP system
|
SAPDatabaseType
Enumeration
Defines the supported SAP Database types.
| Value |
Description |
|
HANA
|
|
|
DB2
|
|
SAPDeploymentType
Enumeration
The deployment type. Eg: SingleServer/ThreeTier
| Value |
Description |
|
SingleServer
|
|
|
ThreeTier
|
|
SAPEnvironmentType
Enumeration
Defines the environment type - Production/Non Production.
| Value |
Description |
|
NonProd
|
|
|
Prod
|
|
SAPHealthState
Enumeration
Defines the health of SAP Instances.
| Value |
Description |
|
Unknown
|
|
|
Healthy
|
|
|
Unhealthy
|
|
|
Degraded
|
|
SAPHighAvailabilityType
Enumeration
The high availability type.
| Value |
Description |
|
AvailabilitySet
|
|
|
AvailabilityZone
|
|
SAPInstallWithoutOSConfigSoftwareConfiguration
Object
The SAP Software configuration Input when the software is to be installed by service without OS Configurations
| Name |
Type |
Description |
|
bomUrl
|
string
|
The URL to the SAP Build of Materials(BOM) file.
|
|
highAvailabilitySoftwareConfiguration
|
HighAvailabilitySoftwareConfiguration
|
Gets or sets the HA software configuration.
|
|
sapBitsStorageAccountId
|
string
|
The SAP bits storage account id.
|
|
softwareInstallationType
|
string:
SAPInstallWithoutOSConfig
|
The SAP software installation Type.
|
|
softwareVersion
|
string
|
The software version to install.
|
SAPProductType
Enumeration
Defines the SAP Product type.
| Value |
Description |
|
ECC
|
|
|
S4HANA
|
|
|
Other
|
|
SAPSoftwareInstallationType
Enumeration
The SAP software installation Type.
| Value |
Description |
|
ServiceInitiated
|
|
|
SAPInstallWithoutOSConfig
|
|
|
External
|
|
SAPVirtualInstance
Object
Define the Virtual Instance for SAP solutions resource.
| Name |
Type |
Description |
|
id
|
string
|
Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
|
|
identity
|
UserAssignedServiceIdentity
|
A pre-created user assigned identity with appropriate roles assigned. To learn more on identity and roles required, visit the ACSS how-to-guide.
|
|
location
|
string
|
The geo-location where the resource lives
|
|
name
|
string
|
The name of the resource
|
|
properties.configuration
|
SAPConfiguration:
|
Defines if the SAP system is being created using Azure Center for SAP solutions (ACSS) or if an existing SAP system is being registered with ACSS
|
|
properties.environment
|
SAPEnvironmentType
|
Defines the environment type - Production/Non Production.
|
|
properties.errors
|
SAPVirtualInstanceError
|
Indicates any errors on the Virtual Instance for SAP solutions resource.
|
|
properties.health
|
SAPHealthState
|
Defines the health of SAP Instances.
|
|
properties.managedResourceGroupConfiguration
|
ManagedRGConfiguration
|
Managed resource group configuration
|
|
properties.provisioningState
|
SapVirtualInstanceProvisioningState
|
Defines the provisioning states.
|
|
properties.sapProduct
|
SAPProductType
|
Defines the SAP Product type.
|
|
properties.state
|
SAPVirtualInstanceState
|
Defines the Virtual Instance for SAP state.
|
|
properties.status
|
SAPVirtualInstanceStatus
|
Defines the SAP Instance status.
|
|
systemData
|
systemData
|
Azure Resource Manager metadata containing createdBy and modifiedBy information.
|
|
tags
|
object
|
Resource tags.
|
|
type
|
string
|
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
|
SAPVirtualInstanceError
Object
An error response from the Virtual Instance for SAP Workload service.
| Name |
Type |
Description |
|
properties
|
ErrorDefinition
|
The Virtual Instance for SAP error body.
|
SapVirtualInstanceProvisioningState
Enumeration
Defines the provisioning states.
| Value |
Description |
|
Succeeded
|
|
|
Updating
|
|
|
Creating
|
|
|
Failed
|
|
|
Deleting
|
|
SAPVirtualInstanceState
Enumeration
Defines the Virtual Instance for SAP state.
| Value |
Description |
|
InfrastructureDeploymentPending
|
|
|
InfrastructureDeploymentInProgress
|
|
|
InfrastructureDeploymentFailed
|
|
|
SoftwareInstallationPending
|
|
|
SoftwareInstallationInProgress
|
|
|
SoftwareInstallationFailed
|
|
|
SoftwareDetectionInProgress
|
|
|
SoftwareDetectionFailed
|
|
|
DiscoveryPending
|
|
|
DiscoveryInProgress
|
|
|
DiscoveryFailed
|
|
|
RegistrationComplete
|
|
SAPVirtualInstanceStatus
Enumeration
Defines the SAP Instance status.
| Value |
Description |
|
Starting
|
|
|
Running
|
|
|
Stopping
|
|
|
Offline
|
|
|
PartiallyRunning
|
|
|
Unavailable
|
|
|
SoftShutdown
|
|
ServiceInitiatedSoftwareConfiguration
Object
The SAP Software configuration Input when the software is to be installed by service.
| Name |
Type |
Description |
|
bomUrl
|
string
|
The URL to the SAP Build of Materials(BOM) file.
|
|
highAvailabilitySoftwareConfiguration
|
HighAvailabilitySoftwareConfiguration
|
Gets or sets the HA software configuration.
|
|
sapBitsStorageAccountId
|
string
|
The SAP bits storage account id.
|
|
sapFqdn
|
string
|
The FQDN to set for the SAP system during install.
|
|
softwareInstallationType
|
string:
ServiceInitiated
|
The SAP software installation Type.
|
|
softwareVersion
|
string
|
The software version to install.
|
|
sshPrivateKey
|
string
|
The SSH private key.
|
sharedStorageResourceNames
Object
The resource names object for shared storage.
| Name |
Type |
Description |
|
sharedStorageAccountName
|
string
|
The full name of the shared storage account. If it is not provided, it will be defaulted to {SID}nfs{guid of 15 chars}.
|
|
sharedStorageAccountPrivateEndPointName
|
string
|
The full name of private end point for the shared storage account. If it is not provided, it will be defaulted to {storageAccountName}_pe
|
SingleServerConfiguration
Object
Gets or sets the single server configuration. For prerequisites for creating the infrastructure, please see here
| Name |
Type |
Description |
|
appResourceGroup
|
string
|
The application resource group where SAP system resources will be deployed.
|
|
customResourceNames
|
SingleServerCustomResourceNames:
SingleServerFullResourceNames
|
The set of custom names to be used for underlying azure resources that are part of the SAP system.
|
|
databaseType
|
SAPDatabaseType
|
The database type.
|
|
dbDiskConfiguration
|
DiskConfiguration
|
Gets or sets the disk configuration.
|
|
deploymentType
|
string:
SingleServer
|
The type of SAP deployment, single server or Three tier.
|
|
networkConfiguration
|
NetworkConfiguration
|
Network configuration for the server
|
|
subnetId
|
string
|
The subnet id.
|
|
virtualMachineConfiguration
|
VirtualMachineConfiguration
|
Gets or sets the virtual machine configuration.
|
SingleServerFullResourceNames
Object
The resource name object where the specified values will be full resource names of the corresponding resources in a single server SAP system.
| Name |
Type |
Description |
|
namingPatternType
|
string:
FullResourceName
|
The pattern type to be used for resource naming.
|
|
virtualMachine
|
VirtualMachineResourceNames
|
The resource names object for virtual machine and related resources.
|
SkipFileShareConfiguration
Object
Gets or sets the file share configuration for scenarios where transport directory fileshare is not created or required.
| Name |
Type |
Description |
|
configurationType
|
string:
Skip
|
The type of file share config.
|
SshConfiguration
Object
SSH configuration for Linux based VMs running on Azure
| Name |
Type |
Description |
|
publicKeys
|
SshPublicKey[]
|
The list of SSH public keys used to authenticate with linux based VMs.
|
SshKeyPair
Object
The SSH Key-pair used to authenticate with the VM. The key needs to be at least 2048-bit and in ssh-rsa format.
For creating ssh keys, see Create SSH keys on Linux and Mac for Linux VMs in Azure.
| Name |
Type |
Description |
|
privateKey
|
string
|
SSH private key.
|
|
publicKey
|
string
|
SSH public key
|
SshPublicKey
Object
Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed.
StorageConfiguration
Object
Gets or sets the storage configuration.
| Name |
Type |
Description |
|
transportFileShareConfiguration
|
FileShareConfiguration:
|
The properties of the transport directory attached to the VIS. The default for transportFileShareConfiguration is the createAndMount flow if storage configuration is missing.
|
systemData
Object
Metadata pertaining to creation and last modification of the resource.
| Name |
Type |
Description |
|
createdAt
|
string
(date-time)
|
The timestamp of resource creation (UTC).
|
|
createdBy
|
string
|
The identity that created the resource.
|
|
createdByType
|
createdByType
|
The type of identity that created the resource.
|
|
lastModifiedAt
|
string
(date-time)
|
The timestamp of resource last modification (UTC)
|
|
lastModifiedBy
|
string
|
The identity that last modified the resource.
|
|
lastModifiedByType
|
createdByType
|
The type of identity that last modified the resource.
|
ThreeTierConfiguration
Object
Gets or sets the three tier SAP configuration. For prerequisites for creating the infrastructure, please see here
ThreeTierFullResourceNames
Object
The resource name object where the specified values will be full resource names of the corresponding resources in a three tier SAP system.
| Name |
Type |
Description |
|
applicationServer
|
ApplicationServerFullResourceNames
|
The full resource names object for application layer resources. The number of entries in this list should be equal to the number VMs to be created for application layer.
|
|
centralServer
|
CentralServerFullResourceNames
|
The full resource names object for central server layer resources.
|
|
databaseServer
|
DatabaseServerFullResourceNames
|
The full resource names object for database layer resources. The number of entries in this list should be equal to the number VMs to be created for database layer.
|
|
namingPatternType
|
string:
FullResourceName
|
The pattern type to be used for resource naming.
|
|
sharedStorage
|
sharedStorageResourceNames
|
The resource names object for shared storage.
|
UserAssignedIdentity
Object
User assigned identity properties
| Name |
Type |
Description |
|
clientId
|
string
(uuid)
|
The client ID of the assigned identity.
|
|
principalId
|
string
(uuid)
|
The principal ID of the assigned identity.
|
UserAssignedServiceIdentity
Object
A pre-created user assigned identity with appropriate roles assigned. To learn more on identity and roles required, visit the ACSS how-to-guide.
VirtualMachineConfiguration
Object
Defines the virtual machine configuration.
| Name |
Type |
Description |
|
imageReference
|
ImageReference
|
The image reference.
|
|
osProfile
|
OSProfile
|
The OS profile.
|
|
vmSize
|
string
|
The virtual machine size.
|
VirtualMachineResourceNames
Object
The resource names object for virtual machine and related resources.
| Name |
Type |
Description |
|
dataDiskNames
|
object
|
The full resource names for virtual machine data disks. This is a dictionary containing list of names of data disks per volume. Currently supported volumes for database layer are ['hana/data', 'hana/log', hana/shared', 'usr/sap', 'os', 'backup']. For application and cs layers, only 'default' volume is supported
|
|
hostName
|
string
|
The full name for virtual-machine's host (computer name). Currently, ACSS only supports host names which are less than or equal to 13 characters long. If this value is not provided, vmName will be used as host name.
|
|
networkInterfaces
|
NetworkInterfaceResourceNames[]
|
The list of network interface name objects for the selected virtual machine. Currently, only one network interface is supported per virtual machine.
|
|
osDiskName
|
string
|
The full name for OS disk attached to the VM. If this value is not provided, it will be named by ARM as per its default naming standards (prefixed with vm name). There is only one OS disk attached per Virtual Machine.
|
|
vmName
|
string
|
The full name for virtual machine. The length of this field can be upto 64 characters. If name is not provided, service uses a default name based on the deployment type. For SingleServer, default name is {SID}vm. In case of HA-AvZone systems, default name will be {SID}{app/ascs/db}z{a/b}vm with an incrementor at the end in case of more than 1 vm per layer. For distributed and HA-AvSet systems, default name will be {SID}{app/ascs/db}vm with an incrementor at the end in case of more than 1 vm per layer.
|
WindowsConfiguration
Object
Specifies Windows operating system settings on the virtual machine.
| Name |
Type |
Description |
|
osType
|
string:
Windows
|
The OS Type
|