Gets a Traffic Manager profile.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficmanagerprofiles/{profileName}?api-version=2022-04-01
URI Parameters
Name |
In |
Required |
Type |
Description |
profileName
|
path |
True
|
string
|
The name of the Traffic Manager profile.
|
resourceGroupName
|
path |
True
|
string
|
The name of the resource group. The name is case insensitive.
|
subscriptionId
|
path |
True
|
string
|
Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
|
api-version
|
query |
True
|
string
|
Client Api Version.
|
Responses
Name |
Type |
Description |
200 OK
|
Profile
|
The Traffic Manager profile.
|
Other Status Codes
|
CloudError
|
Default response. It will be deserialized as per the Error definition.
|
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
Profile-GET-WithEndpoints
Sample request
GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1323/providers/Microsoft.Network/trafficmanagerprofiles/azuresdkfornetautoresttrafficmanager3880?api-version=2022-04-01
/**
* Samples for Profiles GetByResourceGroup.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-
* WithEndpoints.json
*/
/**
* Sample code: Profile-GET-WithEndpoints.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void profileGETWithEndpoints(com.azure.resourcemanager.AzureResourceManager azure) {
azure.trafficManagerProfiles().manager().serviceClient().getProfiles().getByResourceGroupWithResponse(
"azuresdkfornetautoresttrafficmanager1323", "azuresdkfornetautoresttrafficmanager3880",
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.trafficmanager import TrafficManagerManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-trafficmanager
# USAGE
python profile_get_with_endpoints.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = TrafficManagerManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.profiles.get(
resource_group_name="azuresdkfornetautoresttrafficmanager1323",
profile_name="azuresdkfornetautoresttrafficmanager3880",
)
print(response)
# x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-WithEndpoints.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 armtrafficmanager_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trafficmanager/armtrafficmanager"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-WithEndpoints.json
func ExampleProfilesClient_Get_profileGetWithEndpoints() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armtrafficmanager.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewProfilesClient().Get(ctx, "azuresdkfornetautoresttrafficmanager1323", "azuresdkfornetautoresttrafficmanager3880", nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.Profile = armtrafficmanager.Profile{
// Name: to.Ptr("azuresdkfornetautoresttrafficmanager3880"),
// Type: to.Ptr("Microsoft.Network/trafficManagerProfiles"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1323/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager3880"),
// Location: to.Ptr("global"),
// Tags: map[string]*string{
// },
// Properties: &armtrafficmanager.ProfileProperties{
// DNSConfig: &armtrafficmanager.DNSConfig{
// Fqdn: to.Ptr("azuresdkfornetautoresttrafficmanager3880.tmpreview.watmtest.azure-test.net"),
// RelativeName: to.Ptr("azuresdkfornetautoresttrafficmanager3880"),
// TTL: to.Ptr[int64](35),
// },
// Endpoints: []*armtrafficmanager.Endpoint{
// {
// Name: to.Ptr("My external endpoint"),
// Type: to.Ptr("Microsoft.Network/trafficManagerProfiles/externalEndpoints"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1323/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager3880/externalEndpoints/My external endpoint"),
// Properties: &armtrafficmanager.EndpointProperties{
// EndpointLocation: to.Ptr("North Europe"),
// EndpointMonitorStatus: to.Ptr(armtrafficmanager.EndpointMonitorStatusCheckingEndpoint),
// EndpointStatus: to.Ptr(armtrafficmanager.EndpointStatusEnabled),
// Priority: to.Ptr[int64](1),
// Target: to.Ptr("foobar.contoso.com"),
// Weight: to.Ptr[int64](1),
// },
// }},
// MonitorConfig: &armtrafficmanager.MonitorConfig{
// Path: to.Ptr("/testpath.aspx"),
// IntervalInSeconds: to.Ptr[int64](30),
// Port: to.Ptr[int64](80),
// ProfileMonitorStatus: to.Ptr(armtrafficmanager.ProfileMonitorStatusCheckingEndpoints),
// TimeoutInSeconds: to.Ptr[int64](10),
// ToleratedNumberOfFailures: to.Ptr[int64](3),
// Protocol: to.Ptr(armtrafficmanager.MonitorProtocolHTTP),
// },
// ProfileStatus: to.Ptr(armtrafficmanager.ProfileStatusEnabled),
// TrafficRoutingMethod: to.Ptr(armtrafficmanager.TrafficRoutingMethodPerformance),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { TrafficManagerManagementClient } = require("@azure/arm-trafficmanager");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets a Traffic Manager profile.
*
* @summary Gets a Traffic Manager profile.
* x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-WithEndpoints.json
*/
async function profileGetWithEndpoints() {
const subscriptionId = process.env["TRAFFICMANAGER_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName =
process.env["TRAFFICMANAGER_RESOURCE_GROUP"] || "azuresdkfornetautoresttrafficmanager1323";
const profileName = "azuresdkfornetautoresttrafficmanager3880";
const credential = new DefaultAzureCredential();
const client = new TrafficManagerManagementClient(credential, subscriptionId);
const result = await client.profiles.get(resourceGroupName, profileName);
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.TrafficManager.Models;
using Azure.ResourceManager.TrafficManager;
// Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-WithEndpoints.json
// this example is just showing the usage of "Profiles_Get" 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 = "{subscription-id}";
string resourceGroupName = "azuresdkfornetautoresttrafficmanager1323";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this TrafficManagerProfileResource
TrafficManagerProfileCollection collection = resourceGroupResource.GetTrafficManagerProfiles();
// invoke the operation
string profileName = "azuresdkfornetautoresttrafficmanager3880";
NullableResponse<TrafficManagerProfileResource> response = await collection.GetIfExistsAsync(profileName);
TrafficManagerProfileResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine($"Succeeded with null as result");
}
else
{
// 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
TrafficManagerProfileData 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/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1323/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager3880",
"name": "azuresdkfornetautoresttrafficmanager3880",
"type": "Microsoft.Network/trafficManagerProfiles",
"location": "global",
"tags": {},
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"dnsConfig": {
"relativeName": "azuresdkfornetautoresttrafficmanager3880",
"fqdn": "azuresdkfornetautoresttrafficmanager3880.tmpreview.watmtest.azure-test.net",
"ttl": 35
},
"monitorConfig": {
"profileMonitorStatus": "CheckingEndpoints",
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 30,
"toleratedNumberOfFailures": 3,
"timeoutInSeconds": 10
},
"endpoints": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1323/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager3880/externalEndpoints/My external endpoint",
"name": "My external endpoint",
"type": "Microsoft.Network/trafficManagerProfiles/externalEndpoints",
"properties": {
"endpointStatus": "Enabled",
"endpointMonitorStatus": "CheckingEndpoint",
"target": "foobar.contoso.com",
"weight": 1,
"priority": 1,
"endpointLocation": "North Europe"
}
}
]
}
}
Profile-GET-WithTrafficViewDisabled
Sample request
GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1323/providers/Microsoft.Network/trafficmanagerprofiles/azuresdkfornetautoresttrafficmanager3880?api-version=2022-04-01
/**
* Samples for Profiles GetByResourceGroup.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-
* WithTrafficViewDisabled.json
*/
/**
* Sample code: Profile-GET-WithTrafficViewDisabled.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void profileGETWithTrafficViewDisabled(com.azure.resourcemanager.AzureResourceManager azure) {
azure.trafficManagerProfiles().manager().serviceClient().getProfiles().getByResourceGroupWithResponse(
"azuresdkfornetautoresttrafficmanager1323", "azuresdkfornetautoresttrafficmanager3880",
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.trafficmanager import TrafficManagerManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-trafficmanager
# USAGE
python profile_get_with_traffic_view_disabled.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = TrafficManagerManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.profiles.get(
resource_group_name="azuresdkfornetautoresttrafficmanager1323",
profile_name="azuresdkfornetautoresttrafficmanager3880",
)
print(response)
# x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-WithTrafficViewDisabled.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 armtrafficmanager_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trafficmanager/armtrafficmanager"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-WithTrafficViewDisabled.json
func ExampleProfilesClient_Get_profileGetWithTrafficViewDisabled() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armtrafficmanager.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewProfilesClient().Get(ctx, "azuresdkfornetautoresttrafficmanager1323", "azuresdkfornetautoresttrafficmanager3880", nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.Profile = armtrafficmanager.Profile{
// Name: to.Ptr("azuresdkfornetautoresttrafficmanager3880"),
// Type: to.Ptr("Microsoft.Network/trafficManagerProfiles"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1323/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager3880"),
// Location: to.Ptr("global"),
// Tags: map[string]*string{
// },
// Properties: &armtrafficmanager.ProfileProperties{
// DNSConfig: &armtrafficmanager.DNSConfig{
// Fqdn: to.Ptr("azuresdkfornetautoresttrafficmanager3880.tmpreview.watmtest.azure-test.net"),
// RelativeName: to.Ptr("azuresdkfornetautoresttrafficmanager3880"),
// TTL: to.Ptr[int64](35),
// },
// Endpoints: []*armtrafficmanager.Endpoint{
// {
// Name: to.Ptr("My external endpoint"),
// Type: to.Ptr("Microsoft.Network/trafficManagerProfiles/externalEndpoints"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1323/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager3880/externalEndpoints/My external endpoint"),
// Properties: &armtrafficmanager.EndpointProperties{
// EndpointLocation: to.Ptr("North Europe"),
// EndpointMonitorStatus: to.Ptr(armtrafficmanager.EndpointMonitorStatusCheckingEndpoint),
// EndpointStatus: to.Ptr(armtrafficmanager.EndpointStatusEnabled),
// Priority: to.Ptr[int64](1),
// Target: to.Ptr("foobar.contoso.com"),
// Weight: to.Ptr[int64](1),
// },
// }},
// MonitorConfig: &armtrafficmanager.MonitorConfig{
// Path: to.Ptr("/testpath.aspx"),
// IntervalInSeconds: to.Ptr[int64](30),
// Port: to.Ptr[int64](80),
// ProfileMonitorStatus: to.Ptr(armtrafficmanager.ProfileMonitorStatusCheckingEndpoints),
// TimeoutInSeconds: to.Ptr[int64](10),
// ToleratedNumberOfFailures: to.Ptr[int64](3),
// Protocol: to.Ptr(armtrafficmanager.MonitorProtocolHTTP),
// },
// ProfileStatus: to.Ptr(armtrafficmanager.ProfileStatusEnabled),
// TrafficRoutingMethod: to.Ptr(armtrafficmanager.TrafficRoutingMethodPerformance),
// TrafficViewEnrollmentStatus: to.Ptr(armtrafficmanager.TrafficViewEnrollmentStatusDisabled),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { TrafficManagerManagementClient } = require("@azure/arm-trafficmanager");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets a Traffic Manager profile.
*
* @summary Gets a Traffic Manager profile.
* x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-WithTrafficViewDisabled.json
*/
async function profileGetWithTrafficViewDisabled() {
const subscriptionId = process.env["TRAFFICMANAGER_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName =
process.env["TRAFFICMANAGER_RESOURCE_GROUP"] || "azuresdkfornetautoresttrafficmanager1323";
const profileName = "azuresdkfornetautoresttrafficmanager3880";
const credential = new DefaultAzureCredential();
const client = new TrafficManagerManagementClient(credential, subscriptionId);
const result = await client.profiles.get(resourceGroupName, profileName);
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.TrafficManager.Models;
using Azure.ResourceManager.TrafficManager;
// Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-WithTrafficViewDisabled.json
// this example is just showing the usage of "Profiles_Get" 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 = "{subscription-id}";
string resourceGroupName = "azuresdkfornetautoresttrafficmanager1323";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this TrafficManagerProfileResource
TrafficManagerProfileCollection collection = resourceGroupResource.GetTrafficManagerProfiles();
// invoke the operation
string profileName = "azuresdkfornetautoresttrafficmanager3880";
NullableResponse<TrafficManagerProfileResource> response = await collection.GetIfExistsAsync(profileName);
TrafficManagerProfileResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine($"Succeeded with null as result");
}
else
{
// 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
TrafficManagerProfileData 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/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1323/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager3880",
"name": "azuresdkfornetautoresttrafficmanager3880",
"type": "Microsoft.Network/trafficManagerProfiles",
"location": "global",
"tags": {},
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"dnsConfig": {
"relativeName": "azuresdkfornetautoresttrafficmanager3880",
"fqdn": "azuresdkfornetautoresttrafficmanager3880.tmpreview.watmtest.azure-test.net",
"ttl": 35
},
"monitorConfig": {
"profileMonitorStatus": "CheckingEndpoints",
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 30,
"toleratedNumberOfFailures": 3,
"timeoutInSeconds": 10
},
"endpoints": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1323/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager3880/externalEndpoints/My external endpoint",
"name": "My external endpoint",
"type": "Microsoft.Network/trafficManagerProfiles/externalEndpoints",
"properties": {
"endpointStatus": "Enabled",
"endpointMonitorStatus": "CheckingEndpoint",
"target": "foobar.contoso.com",
"weight": 1,
"priority": 1,
"endpointLocation": "North Europe"
}
}
],
"trafficViewEnrollmentStatus": "Disabled"
}
}
Profile-GET-WithTrafficViewEnabled
Sample request
GET https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1323/providers/Microsoft.Network/trafficmanagerprofiles/azuresdkfornetautoresttrafficmanager3880?api-version=2022-04-01
/**
* Samples for Profiles GetByResourceGroup.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-
* WithTrafficViewEnabled.json
*/
/**
* Sample code: Profile-GET-WithTrafficViewEnabled.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void profileGETWithTrafficViewEnabled(com.azure.resourcemanager.AzureResourceManager azure) {
azure.trafficManagerProfiles().manager().serviceClient().getProfiles().getByResourceGroupWithResponse(
"azuresdkfornetautoresttrafficmanager1323", "azuresdkfornetautoresttrafficmanager3880",
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.trafficmanager import TrafficManagerManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-trafficmanager
# USAGE
python profile_get_with_traffic_view_enabled.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = TrafficManagerManagementClient(
credential=DefaultAzureCredential(),
subscription_id="{subscription-id}",
)
response = client.profiles.get(
resource_group_name="azuresdkfornetautoresttrafficmanager1323",
profile_name="azuresdkfornetautoresttrafficmanager3880",
)
print(response)
# x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-WithTrafficViewEnabled.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 armtrafficmanager_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/trafficmanager/armtrafficmanager"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-WithTrafficViewEnabled.json
func ExampleProfilesClient_Get_profileGetWithTrafficViewEnabled() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armtrafficmanager.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewProfilesClient().Get(ctx, "azuresdkfornetautoresttrafficmanager1323", "azuresdkfornetautoresttrafficmanager3880", nil)
if err != nil {
log.Fatalf("failed to finish the request: %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.Profile = armtrafficmanager.Profile{
// Name: to.Ptr("azuresdkfornetautoresttrafficmanager3880"),
// Type: to.Ptr("Microsoft.Network/trafficManagerProfiles"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1323/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager3880"),
// Location: to.Ptr("global"),
// Tags: map[string]*string{
// },
// Properties: &armtrafficmanager.ProfileProperties{
// DNSConfig: &armtrafficmanager.DNSConfig{
// Fqdn: to.Ptr("azuresdkfornetautoresttrafficmanager3880.tmpreview.watmtest.azure-test.net"),
// RelativeName: to.Ptr("azuresdkfornetautoresttrafficmanager3880"),
// TTL: to.Ptr[int64](35),
// },
// Endpoints: []*armtrafficmanager.Endpoint{
// {
// Name: to.Ptr("My external endpoint"),
// Type: to.Ptr("Microsoft.Network/trafficManagerProfiles/externalEndpoints"),
// ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1323/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager3880/externalEndpoints/My external endpoint"),
// Properties: &armtrafficmanager.EndpointProperties{
// EndpointLocation: to.Ptr("North Europe"),
// EndpointMonitorStatus: to.Ptr(armtrafficmanager.EndpointMonitorStatusCheckingEndpoint),
// EndpointStatus: to.Ptr(armtrafficmanager.EndpointStatusEnabled),
// Priority: to.Ptr[int64](1),
// Target: to.Ptr("foobar.contoso.com"),
// Weight: to.Ptr[int64](1),
// },
// }},
// MonitorConfig: &armtrafficmanager.MonitorConfig{
// Path: to.Ptr("/testpath.aspx"),
// IntervalInSeconds: to.Ptr[int64](30),
// Port: to.Ptr[int64](80),
// ProfileMonitorStatus: to.Ptr(armtrafficmanager.ProfileMonitorStatusCheckingEndpoints),
// TimeoutInSeconds: to.Ptr[int64](10),
// ToleratedNumberOfFailures: to.Ptr[int64](3),
// Protocol: to.Ptr(armtrafficmanager.MonitorProtocolHTTP),
// },
// ProfileStatus: to.Ptr(armtrafficmanager.ProfileStatusEnabled),
// TrafficRoutingMethod: to.Ptr(armtrafficmanager.TrafficRoutingMethodPerformance),
// TrafficViewEnrollmentStatus: to.Ptr(armtrafficmanager.TrafficViewEnrollmentStatusEnabled),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { TrafficManagerManagementClient } = require("@azure/arm-trafficmanager");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets a Traffic Manager profile.
*
* @summary Gets a Traffic Manager profile.
* x-ms-original-file: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-WithTrafficViewEnabled.json
*/
async function profileGetWithTrafficViewEnabled() {
const subscriptionId = process.env["TRAFFICMANAGER_SUBSCRIPTION_ID"] || "{subscription-id}";
const resourceGroupName =
process.env["TRAFFICMANAGER_RESOURCE_GROUP"] || "azuresdkfornetautoresttrafficmanager1323";
const profileName = "azuresdkfornetautoresttrafficmanager3880";
const credential = new DefaultAzureCredential();
const client = new TrafficManagerManagementClient(credential, subscriptionId);
const result = await client.profiles.get(resourceGroupName, profileName);
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.TrafficManager.Models;
using Azure.ResourceManager.TrafficManager;
// Generated from example definition: specification/trafficmanager/resource-manager/Microsoft.Network/stable/2022-04-01/examples/Profile-GET-WithTrafficViewEnabled.json
// this example is just showing the usage of "Profiles_Get" 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 = "{subscription-id}";
string resourceGroupName = "azuresdkfornetautoresttrafficmanager1323";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this TrafficManagerProfileResource
TrafficManagerProfileCollection collection = resourceGroupResource.GetTrafficManagerProfiles();
// invoke the operation
string profileName = "azuresdkfornetautoresttrafficmanager3880";
NullableResponse<TrafficManagerProfileResource> response = await collection.GetIfExistsAsync(profileName);
TrafficManagerProfileResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine($"Succeeded with null as result");
}
else
{
// 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
TrafficManagerProfileData 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/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1323/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager3880",
"name": "azuresdkfornetautoresttrafficmanager3880",
"type": "Microsoft.Network/trafficManagerProfiles",
"location": "global",
"tags": {},
"properties": {
"profileStatus": "Enabled",
"trafficRoutingMethod": "Performance",
"dnsConfig": {
"relativeName": "azuresdkfornetautoresttrafficmanager3880",
"fqdn": "azuresdkfornetautoresttrafficmanager3880.tmpreview.watmtest.azure-test.net",
"ttl": 35
},
"monitorConfig": {
"profileMonitorStatus": "CheckingEndpoints",
"protocol": "HTTP",
"port": 80,
"path": "/testpath.aspx",
"intervalInSeconds": 30,
"toleratedNumberOfFailures": 3,
"timeoutInSeconds": 10
},
"endpoints": [
{
"id": "/subscriptions/{subscription-id}/resourceGroups/azuresdkfornetautoresttrafficmanager1323/providers/Microsoft.Network/trafficManagerProfiles/azuresdkfornetautoresttrafficmanager3880/externalEndpoints/My external endpoint",
"name": "My external endpoint",
"type": "Microsoft.Network/trafficManagerProfiles/externalEndpoints",
"properties": {
"endpointStatus": "Enabled",
"endpointMonitorStatus": "CheckingEndpoint",
"target": "foobar.contoso.com",
"weight": 1,
"priority": 1,
"endpointLocation": "North Europe"
}
}
],
"trafficViewEnrollmentStatus": "Enabled"
}
}
Definitions
Name |
Description |
AllowedEndpointRecordType
|
The allowed type DNS record types for this profile.
|
AlwaysServe
|
If Always Serve is enabled, probing for endpoint health will be disabled and endpoints will be included in the traffic routing method.
|
CloudError
|
An error returned by the Azure Resource Manager
|
CloudErrorBody
|
The content of an error returned by the Azure Resource Manager
|
CustomHeaders
|
List of custom headers.
|
DnsConfig
|
Class containing DNS settings in a Traffic Manager profile.
|
Endpoint
|
Class representing a Traffic Manager endpoint.
|
EndpointMonitorStatus
|
The monitoring status of the endpoint.
|
EndpointStatus
|
The status of the endpoint. If the endpoint is Enabled, it is probed for endpoint health and is included in the traffic routing method.
|
ExpectedStatusCodeRanges
|
List of expected status code ranges.
|
MonitorConfig
|
Class containing endpoint monitoring settings in a Traffic Manager profile.
|
MonitorProtocol
|
The protocol (HTTP, HTTPS or TCP) used to probe for endpoint health.
|
Profile
|
Class representing a Traffic Manager profile.
|
ProfileMonitorStatus
|
The profile-level monitoring status of the Traffic Manager profile.
|
ProfileStatus
|
The status of the Traffic Manager profile.
|
Subnets
|
The list of subnets, IP addresses, and/or address ranges mapped to this endpoint when using the 'Subnet' traffic routing method. An empty list will match all ranges not covered by other endpoints.
|
TrafficRoutingMethod
|
The traffic routing method of the Traffic Manager profile.
|
TrafficViewEnrollmentStatus
|
Indicates whether Traffic View is 'Enabled' or 'Disabled' for the Traffic Manager profile. Null, indicates 'Disabled'. Enabling this feature will increase the cost of the Traffic Manage profile.
|
AllowedEndpointRecordType
The allowed type DNS record types for this profile.
Name |
Type |
Description |
Any
|
string
|
|
DomainName
|
string
|
|
IPv4Address
|
string
|
|
IPv6Address
|
string
|
|
AlwaysServe
If Always Serve is enabled, probing for endpoint health will be disabled and endpoints will be included in the traffic routing method.
Name |
Type |
Description |
Disabled
|
string
|
|
Enabled
|
string
|
|
CloudError
An error returned by the Azure Resource Manager
CloudErrorBody
The content of an error returned by the Azure Resource Manager
Name |
Type |
Description |
code
|
string
|
Error code
|
details
|
CloudErrorBody[]
|
Error details
|
message
|
string
|
Error message
|
target
|
string
|
Error target
|
List of custom headers.
Name |
Type |
Description |
name
|
string
|
Header name.
|
value
|
string
|
Header value.
|
DnsConfig
Class containing DNS settings in a Traffic Manager profile.
Name |
Type |
Description |
fqdn
|
string
|
The fully-qualified domain name (FQDN) of the Traffic Manager profile. This is formed from the concatenation of the RelativeName with the DNS domain used by Azure Traffic Manager.
|
relativeName
|
string
|
The relative DNS name provided by this Traffic Manager profile. This value is combined with the DNS domain name used by Azure Traffic Manager to form the fully-qualified domain name (FQDN) of the profile.
|
ttl
|
integer
|
The DNS Time-To-Live (TTL), in seconds. This informs the local DNS resolvers and DNS clients how long to cache DNS responses provided by this Traffic Manager profile.
|
Endpoint
Class representing a Traffic Manager endpoint.
Name |
Type |
Description |
id
|
string
|
Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}
|
name
|
string
|
The name of the resource
|
properties.alwaysServe
|
AlwaysServe
|
If Always Serve is enabled, probing for endpoint health will be disabled and endpoints will be included in the traffic routing method.
|
properties.customHeaders
|
CustomHeaders[]
|
List of custom headers.
|
properties.endpointLocation
|
string
|
Specifies the location of the external or nested endpoints when using the 'Performance' traffic routing method.
|
properties.endpointMonitorStatus
|
EndpointMonitorStatus
|
The monitoring status of the endpoint.
|
properties.endpointStatus
|
EndpointStatus
|
The status of the endpoint. If the endpoint is Enabled, it is probed for endpoint health and is included in the traffic routing method.
|
properties.geoMapping
|
string[]
|
The list of countries/regions mapped to this endpoint when using the 'Geographic' traffic routing method. Please consult Traffic Manager Geographic documentation for a full list of accepted values.
|
properties.minChildEndpoints
|
integer
|
The minimum number of endpoints that must be available in the child profile in order for the parent profile to be considered available. Only applicable to endpoint of type 'NestedEndpoints'.
|
properties.minChildEndpointsIPv4
|
integer
|
The minimum number of IPv4 (DNS record type A) endpoints that must be available in the child profile in order for the parent profile to be considered available. Only applicable to endpoint of type 'NestedEndpoints'.
|
properties.minChildEndpointsIPv6
|
integer
|
The minimum number of IPv6 (DNS record type AAAA) endpoints that must be available in the child profile in order for the parent profile to be considered available. Only applicable to endpoint of type 'NestedEndpoints'.
|
properties.priority
|
integer
|
The priority of this endpoint when using the 'Priority' traffic routing method. Possible values are from 1 to 1000, lower values represent higher priority. This is an optional parameter. If specified, it must be specified on all endpoints, and no two endpoints can share the same priority value.
|
properties.subnets
|
Subnets[]
|
The list of subnets, IP addresses, and/or address ranges mapped to this endpoint when using the 'Subnet' traffic routing method. An empty list will match all ranges not covered by other endpoints.
|
properties.target
|
string
|
The fully-qualified DNS name or IP address of the endpoint. Traffic Manager returns this value in DNS responses to direct traffic to this endpoint.
|
properties.targetResourceId
|
string
|
The Azure Resource URI of the of the endpoint. Not applicable to endpoints of type 'ExternalEndpoints'.
|
properties.weight
|
integer
|
The weight of this endpoint when using the 'Weighted' traffic routing method. Possible values are from 1 to 1000.
|
type
|
string
|
The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles.
|
EndpointMonitorStatus
The monitoring status of the endpoint.
Name |
Type |
Description |
CheckingEndpoint
|
string
|
|
Degraded
|
string
|
|
Disabled
|
string
|
|
Inactive
|
string
|
|
Online
|
string
|
|
Stopped
|
string
|
|
Unmonitored
|
string
|
|
EndpointStatus
The status of the endpoint. If the endpoint is Enabled, it is probed for endpoint health and is included in the traffic routing method.
Name |
Type |
Description |
Disabled
|
string
|
|
Enabled
|
string
|
|
ExpectedStatusCodeRanges
List of expected status code ranges.
Name |
Type |
Description |
max
|
integer
|
Max status code.
|
min
|
integer
|
Min status code.
|
MonitorConfig
Class containing endpoint monitoring settings in a Traffic Manager profile.
Name |
Type |
Description |
customHeaders
|
CustomHeaders[]
|
List of custom headers.
|
expectedStatusCodeRanges
|
ExpectedStatusCodeRanges[]
|
List of expected status code ranges.
|
intervalInSeconds
|
integer
|
The monitor interval for endpoints in this profile. This is the interval at which Traffic Manager will check the health of each endpoint in this profile.
|
path
|
string
|
The path relative to the endpoint domain name used to probe for endpoint health.
|
port
|
integer
|
The TCP port used to probe for endpoint health.
|
profileMonitorStatus
|
ProfileMonitorStatus
|
The profile-level monitoring status of the Traffic Manager profile.
|
protocol
|
MonitorProtocol
|
The protocol (HTTP, HTTPS or TCP) used to probe for endpoint health.
|
timeoutInSeconds
|
integer
|
The monitor timeout for endpoints in this profile. This is the time that Traffic Manager allows endpoints in this profile to response to the health check.
|
toleratedNumberOfFailures
|
integer
|
The number of consecutive failed health check that Traffic Manager tolerates before declaring an endpoint in this profile Degraded after the next failed health check.
|
MonitorProtocol
The protocol (HTTP, HTTPS or TCP) used to probe for endpoint health.
Name |
Type |
Description |
HTTP
|
string
|
|
HTTPS
|
string
|
|
TCP
|
string
|
|
Profile
Class representing a Traffic Manager profile.
Name |
Type |
Description |
id
|
string
|
Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{resourceName}
|
location
|
string
|
The Azure Region where the resource lives
|
name
|
string
|
The name of the resource
|
properties.allowedEndpointRecordTypes
|
AllowedEndpointRecordType[]
|
The list of allowed endpoint record types.
|
properties.dnsConfig
|
DnsConfig
|
The DNS settings of the Traffic Manager profile.
|
properties.endpoints
|
Endpoint[]
|
The list of endpoints in the Traffic Manager profile.
|
properties.maxReturn
|
integer
|
Maximum number of endpoints to be returned for MultiValue routing type.
|
properties.monitorConfig
|
MonitorConfig
|
The endpoint monitoring settings of the Traffic Manager profile.
|
properties.profileStatus
|
ProfileStatus
|
The status of the Traffic Manager profile.
|
properties.trafficRoutingMethod
|
TrafficRoutingMethod
|
The traffic routing method of the Traffic Manager profile.
|
properties.trafficViewEnrollmentStatus
|
TrafficViewEnrollmentStatus
|
Indicates whether Traffic View is 'Enabled' or 'Disabled' for the Traffic Manager profile. Null, indicates 'Disabled'. Enabling this feature will increase the cost of the Traffic Manage profile.
|
tags
|
object
|
Resource tags.
|
type
|
string
|
The type of the resource. Ex- Microsoft.Network/trafficManagerProfiles.
|
ProfileMonitorStatus
The profile-level monitoring status of the Traffic Manager profile.
Name |
Type |
Description |
CheckingEndpoints
|
string
|
|
Degraded
|
string
|
|
Disabled
|
string
|
|
Inactive
|
string
|
|
Online
|
string
|
|
ProfileStatus
The status of the Traffic Manager profile.
Name |
Type |
Description |
Disabled
|
string
|
|
Enabled
|
string
|
|
Subnets
The list of subnets, IP addresses, and/or address ranges mapped to this endpoint when using the 'Subnet' traffic routing method. An empty list will match all ranges not covered by other endpoints.
Name |
Type |
Description |
first
|
string
|
First address in the subnet.
|
last
|
string
|
Last address in the subnet.
|
scope
|
integer
|
Block size (number of leading bits in the subnet mask).
|
TrafficRoutingMethod
The traffic routing method of the Traffic Manager profile.
Name |
Type |
Description |
Geographic
|
string
|
|
MultiValue
|
string
|
|
Performance
|
string
|
|
Priority
|
string
|
|
Subnet
|
string
|
|
Weighted
|
string
|
|
TrafficViewEnrollmentStatus
Indicates whether Traffic View is 'Enabled' or 'Disabled' for the Traffic Manager profile. Null, indicates 'Disabled'. Enabling this feature will increase the cost of the Traffic Manage profile.
Name |
Type |
Description |
Disabled
|
string
|
|
Enabled
|
string
|
|