POST https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/oracleSubscriptions/default/addAzureSubscriptions?api-version=2025-03-01
{
"azureSubscriptionIds": [
"00000000-0000-0000-0000-000000000001"
]
}
import com.azure.resourcemanager.oracledatabase.models.AzureSubscriptions;
import java.util.Arrays;
/**
* Samples for OracleSubscriptions AddAzureSubscriptions.
*/
public final class Main {
/*
* x-ms-original-file: 2025-03-01/oracleSubscriptions_addAzureSubscriptions.json
*/
/**
* Sample code: OracleSubscriptions_addAzureSubscriptions.
*
* @param manager Entry point to OracleDatabaseManager.
*/
public static void oracleSubscriptionsAddAzureSubscriptions(
com.azure.resourcemanager.oracledatabase.OracleDatabaseManager manager) {
manager.oracleSubscriptions().addAzureSubscriptions(
new AzureSubscriptions().withAzureSubscriptionIds(Arrays.asList("00000000-0000-0000-0000-000000000001")),
com.azure.core.util.Context.NONE);
}
}
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.oracledatabase import OracleDatabaseMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-oracledatabase
# USAGE
python oracle_subscriptions_add_azure_subscriptions.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = OracleDatabaseMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
client.oracle_subscriptions.begin_add_azure_subscriptions(
body={"azureSubscriptionIds": ["00000000-0000-0000-0000-000000000001"]},
).result()
# x-ms-original-file: 2025-03-01/oracleSubscriptions_addAzureSubscriptions.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 armoracledatabase_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/oracledatabase/armoracledatabase"
)
// Generated from example definition: 2025-03-01/oracleSubscriptions_addAzureSubscriptions.json
func ExampleOracleSubscriptionsClient_BeginAddAzureSubscriptions() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewOracleSubscriptionsClient().BeginAddAzureSubscriptions(ctx, armoracledatabase.AzureSubscriptions{
AzureSubscriptionIDs: []*string{
to.Ptr("00000000-0000-0000-0000-000000000001"),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { OracleDatabaseManagementClient } = require("@azure/arm-oracledatabase");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to add Azure Subscriptions
*
* @summary add Azure Subscriptions
* x-ms-original-file: 2025-03-01/oracleSubscriptions_addAzureSubscriptions.json
*/
async function oracleSubscriptionsAddAzureSubscriptions() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-0000-0000-0000-000000000000";
const client = new OracleDatabaseManagementClient(credential, subscriptionId);
await client.oracleSubscriptions.addAzureSubscriptions({
azureSubscriptionIds: ["00000000-0000-0000-0000-000000000001"],
});
}
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.OracleDatabase.Models;
using Azure.ResourceManager.OracleDatabase;
// Generated from example definition: 2025-03-01/oracleSubscriptions_addAzureSubscriptions.json
// this example is just showing the usage of "OracleSubscriptions_AddAzureSubscriptions" 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 OracleSubscriptionResource created on azure
// for more information of creating OracleSubscriptionResource, please refer to the document of OracleSubscriptionResource
string subscriptionId = "00000000-0000-0000-0000-000000000000";
ResourceIdentifier oracleSubscriptionResourceId = OracleSubscriptionResource.CreateResourceIdentifier(subscriptionId);
OracleSubscriptionResource oracleSubscription = client.GetOracleSubscriptionResource(oracleSubscriptionResourceId);
// invoke the operation
OracleAzureSubscriptionsContent content = new OracleAzureSubscriptionsContent(new string[] { "00000000-0000-0000-0000-000000000001" });
await oracleSubscription.AddAzureSubscriptionsAsync(WaitUntil.Completed, content);
Console.WriteLine("Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue