protected void WriteComponent(ApplicationInsightsComponent component) { if (component != null) { WriteObject(PSApplicationInsightsComponent.Create(component)); } }
public PSApplicationInsightsComponent(ApplicationInsightsComponent component) { this.ResourceGroupName = ParseResourceGroupFromId(component.Id); this.Name = component.Name; this.Id = component.Id; this.Location = component.Location; this.Tags = component.Tags; this.Kind = component.Kind; this.Type = component.Type; this.AppId = component.AppId; this.ApplicationId = component.ApplicationId; this.ApplicationType = component.ApplicationType; this.CreationDate = component.CreationDate; this.FlowType = component.FlowType; this.HockeyAppId = component.HockeyAppId; this.HockeyAppToken = component.HockeyAppToken; this.InstrumentationKey = component.InstrumentationKey; this.ProvisioningState = component.ProvisioningState; this.RequestSource = component.RequestSource; this.SamplingPercentage = component.SamplingPercentage; this.TenantId = component.TenantId; this.PublicNetworkAccessForIngestion = component.PublicNetworkAccessForIngestion; this.PublicNetworkAccessForQuery = component.PublicNetworkAccessForQuery; this.PrivateLinkScopedResources = component.PrivateLinkScopedResources; this.RetentionInDays = component.RetentionInDays; this.ConnectionString = component.ConnectionString; }
public async Task <ApplicationInsightsAccount> CreateApplicationInsightsAsync( Guid subscriptionId, string location, string resourceGroupName, string appInsightsName, string environmentName) { await RegisterProvider(subscriptionId, "Microsoft.Insights"); var accessToken = await GetAccessToken(); var token = new TokenCredentials(accessToken); var appInsightsClient = new ApplicationInsightsManagementClient(token) { SubscriptionId = subscriptionId.ToString() }; var props = new ApplicationInsightsComponent(location, "other", "other", tags: GetEnvironmentTags(environmentName)); var appInsightsComponent = await appInsightsClient.Components.CreateOrUpdateAsync(resourceGroupName, appInsightsName, props); return(new ApplicationInsightsAccount { ResourceId = appInsightsComponent.Id, Location = location, ApplicationId = appInsightsComponent.AppId, InstrumentationKey = appInsightsComponent.InstrumentationKey, ExistingResource = false, }); }
protected void WriteComponentWithPricingPlan(ApplicationInsightsComponent component, ApplicationInsightsComponentBillingFeatures billing, ApplicationInsightsComponentQuotaStatus status) { if (component != null && billing != null) { WriteObject(new PSApplicationInsightsComponentWithPricingPlan(component, billing, status)); } }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); ApplicationInsightsComponent existingComponent = null; try { existingComponent = this.AppInsightsManagementClient .Components .GetWithHttpMessagesAsync(ResourceGroupName, Name) .GetAwaiter() .GetResult() .Body; } catch (CloudException) { existingComponent = null; } if (existingComponent != null) { throw new System.ArgumentException($"component {Name} already existing in Resource Group {ResourceGroupName}"); } ApplicationInsightsComponent newComponentProperties = new ApplicationInsightsComponent() { Location = this.Location, Kind = this.Kind, ApplicationType = Kind, Tags = TagsConversionHelper.CreateTagDictionary(this.Tag, validate: true), RequestSource = "AzurePowerShell", RetentionInDays = this.RetentionInDays == null ? null : this.RetentionInDays, PublicNetworkAccessForIngestion = this.PublicNetworkAccessForIngestion, PublicNetworkAccessForQuery = this.PublicNetworkAccessForQuery }; if (this.ShouldProcess(this.ResourceGroupName, $"Create Application Insights Component {this.Name}")) { var newComponentResponse = this.AppInsightsManagementClient .Components .CreateOrUpdateWithHttpMessagesAsync( ResourceGroupName, Name, newComponentProperties) .Result; this.WriteComponent(newComponentResponse.Body); } }
public async void CreateAppInsightsTest() { Env.Load("../../../../../.env"); var client = new ApplicationInsightsManagementClient(new DefaultAzureMgmtCredential()); client.SubscriptionId = Environment.GetEnvironmentVariable("AZURE_SUBSCRIPTION_ID"); var component = new ApplicationInsightsComponent(Environment.GetEnvironmentVariable("AZURE_REGION"), "web", "web"); var name = Environment.GetEnvironmentVariable("APPINSIGHTS_NAME") + Guid.NewGuid().ToString("n").Substring(0, 8); component = await client.Components.CreateOrUpdateAsync(Environment.GetEnvironmentVariable("AZURE_RESOURCE_GROUP"), name, component); Assert.NotNull(component.CreationDate); }
public PSApplicationInsightsComponentWithPricingPlan(ApplicationInsightsComponent component, ApplicationInsightsComponentBillingFeatures billing, ApplicationInsightsComponentQuotaStatus status) : base(component) { if (billing.CurrentBillingFeatures.Any(f => f.Contains("Enterprise"))) { this.PricingPlan = "Application Insights Enterprise"; } else { this.PricingPlan = billing.CurrentBillingFeatures.FirstOrDefault(); } this.Cap = billing.DataVolumeCap.Cap; this.ResetTime = billing.DataVolumeCap.ResetTime; this.StopSendNotificationWhenHitCap = billing.DataVolumeCap.StopSendNotificationWhenHitCap.Value; this.CapExpirationTime = status.ExpirationTime; this.IsCapped = status.ShouldBeThrottled != null ? status.ShouldBeThrottled.Value : false; }
protected AzureOperationResponse <ApplicationInsightsComponent> CreateAComponent(ApplicationInsightsManagementClient insightsClient, string resourceGroupName, string componentName) { ApplicationInsightsComponent bodyParameter = GetCreateComponentProperties(componentName); //"create new component"; var createdComponentResponse = insightsClient .Components .CreateOrUpdateWithHttpMessagesAsync( resourceGroupName, componentName, insightProperties: bodyParameter) .GetAwaiter() .GetResult(); //verify Assert.Equal(bodyParameter.Name, createdComponentResponse.Body.Name); Assert.Equal(bodyParameter.RequestSource, createdComponentResponse.Body.RequestSource); Assert.Equal(bodyParameter.FlowType, createdComponentResponse.Body.FlowType); Assert.Equal(bodyParameter.Kind, createdComponentResponse.Body.Kind); return(createdComponentResponse); }
public async void CreateAndDeleteAppInsightsTest() { Env.Load("../../../../../.env"); var baseName = Environment.GetEnvironmentVariable("AZURE_BASE_NAME"); var rgName = string.Format("{0}rg", baseName); // App Insights var client = new ApplicationInsightsManagementClient(new AzureIdentityCredentialAdapter()); client.SubscriptionId = Environment.GetEnvironmentVariable("AZURE_SUBSCRIPTION_ID"); var component = new ApplicationInsightsComponent("westus", "web", "web"); var aiName = "appinsightsname" + Guid.NewGuid().ToString("n").Substring(0, 8); component = await client.Components.CreateOrUpdateAsync(rgName, aiName, component); Assert.NotNull(component.CreationDate); await client.Components.DeleteAsync(rgName, aiName); }
public PSApplicationInsightsComponent(ApplicationInsightsComponent component) { this.ResourceGroupName = ParseResourceGroupFromId(component.Id); this.Name = component.Name; this.Id = component.Id; this.Location = component.Location; this.Tags = component.Tags; this.Kind = component.Kind; this.Type = component.Type; this.AppId = component.AppId; this.ApplicationType = component.ApplicationType; this.CreationDate = component.CreationDate; this.FlowType = component.FlowType; this.HockeyAppId = component.HockeyAppId; this.HockeyAppToken = component.HockeyAppToken; this.InstrumentationKey = component.InstrumentationKey; this.ProvisioningState = component.ProvisioningState; this.RequestSource = component.RequestSource; this.SamplingPercentage = component.SamplingPercentage; this.TenantId = component.TenantId; }
public IIoTEnvironment( AzureEnvironment azureEnvironment, Guid tenantId, // IoT Hub IotHubDescription iotHub, string iotHubOwnerConnectionString, string iotHubEventHubEventsEndpointName, EventHubConsumerGroupInfo iotHubEventHubConsumerGroupEvents, EventHubConsumerGroupInfo iotHubEventHubConsumerGroupTelemetry, EventHubConsumerGroupInfo iotHubEventHubConsumerGroupTunnel, EventHubConsumerGroupInfo iotHubEventHubConsumerGroupOnboarding, // Cosmos DB string cosmosDBAccountConnectionString, // Storage Account string storageAccountConectionString, string storageAccountContainerDataprotection, // ADLS Gen2 Storage Account string adlsAccount, string adlsAccountKey, string adlsEndpointSuffix, string adlsConectionString, string adlsContainerCdm, string adlsContainerCdmRootFolder, // Event Hub Namespace EventhubInner eventHub, string eventHubConnectionString, ConsumerGroupInner telemetryCdm, ConsumerGroupInner telemetryUx, // Service Bus string serviceBusConnectionString, // SignalR string signalRConnectionString, string signalRServiceMode, // Key Vault VaultInner keyVault, string dataprotectionKeyName, // Application Insights ApplicationInsightsComponent applicationInsightsComponent, // Log Analytics Workspace Workspace workspace, string workspaceKey, // Service URL string serviceURL, // App Registrations Application serviceApplication, string serviceApplicationSecret, Application clientApplication, string clientApplicationSecret ) { // IoT Hub PCS_IOTHUB_CONNSTRING = iotHubOwnerConnectionString; PCS_IOTHUB_EVENTHUBENDPOINT = iotHub.Properties.EventHubEndpoints[iotHubEventHubEventsEndpointName].Endpoint; PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_EVENTS = iotHubEventHubConsumerGroupEvents.Name; PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_TELEMETRY = iotHubEventHubConsumerGroupTelemetry.Name; PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_TUNNEL = iotHubEventHubConsumerGroupTunnel.Name; PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_ONBOARDING = iotHubEventHubConsumerGroupOnboarding.Name; // Cosmos DB PCS_COSMOSDB_CONNSTRING = cosmosDBAccountConnectionString; // Storage Account PCS_STORAGE_CONNSTRING = storageAccountConectionString; PCS_STORAGE_CONTAINER_DATAPROTECTION = storageAccountContainerDataprotection; // ADLS Gen2 Storage Account // NOTE: PCS_ADLSG2_ACCOUNT, PCS_ADLSG2_ACCOUNT_KEY and PCS_ADLSG2_ENDPOINTSUFFIX are required // for <2.8.5 version of components as processing of PCS_ADLSG2_CONNSTRING is not present there. PCS_ADLSG2_ACCOUNT = adlsAccount; PCS_ADLSG2_ACCOUNT_KEY = adlsAccountKey; PCS_ADLSG2_ENDPOINTSUFFIX = adlsEndpointSuffix; PCS_ADLSG2_CONNSTRING = adlsConectionString; PCS_ADLSG2_CONTAINER_CDM = adlsContainerCdm; PCS_ADLSG2_CONTAINER_CDM_ROOTFOLDER = adlsContainerCdmRootFolder; // Event Hub Namespace PCS_EVENTHUB_CONNSTRING = eventHubConnectionString; PCS_EVENTHUB_NAME = eventHub.Name; PCS_EVENTHUB_CONSUMERGROUP_TELEMETRY_CDM = telemetryCdm.Name; PCS_EVENTHUB_CONSUMERGROUP_TELEMETRY_UX = telemetryUx.Name; // Service Bus PCS_SERVICEBUS_CONNSTRING = serviceBusConnectionString; // Key Vault PCS_KEYVAULT_URL = keyVault.Properties.VaultUri; PCS_KEYVAULT_KEY_DATAPROTECTION = dataprotectionKeyName; PCS_KEYVAULT_APPID = serviceApplication.AppId; PCS_KEYVAULT_SECRET = serviceApplicationSecret; // Application Insights PCS_APPINSIGHTS_INSTRUMENTATIONKEY = applicationInsightsComponent.InstrumentationKey; // Log Analytics Workspace PCS_WORKSPACE_ID = workspace.Id; PCS_WORKSPACE_KEY = workspaceKey; // Service URLs PCS_SERVICE_URL = serviceURL; // Service URLs that will be consumed by microservices. PCS_TWIN_REGISTRY_URL = $"{serviceURL}/registry/"; PCS_TWIN_SERVICE_URL = $"{serviceURL}/twin/"; PCS_HISTORY_SERVICE_URL = $"{serviceURL}/history/"; PCS_VAULT_SERVICE_URL = $"{serviceURL}/vault/"; PCS_PUBLISHER_SERVICE_URL = $"{serviceURL}/publisher/"; PCS_PUBLISHER_ORCHESTRATOR_SERVICE_URL = $"{serviceURL}/edge/publisher/"; PCS_EVENTS_SERVICE_URL = $"{serviceURL}/events/"; // SignalR PCS_SIGNALR_CONNSTRING = signalRConnectionString; PCS_SIGNALR_MODE = signalRServiceMode; // Authentication PCS_AUTH_REQUIRED = $"{true}"; PCS_AUTH_TENANT = $"{tenantId}"; // ToDo: Check value of PCS_AUTH_INSTANCE. //PCS_AUTH_INSTANCE = "https://login.microsoftonline.com/"; PCS_AUTH_INSTANCE = azureEnvironment.AuthenticationEndpoint; PCS_AUTH_ISSUER = $"https://sts.windows.net/{tenantId}/"; PCS_AUTH_HTTPSREDIRECTPORT = $"{0}"; PCS_AUTH_AUDIENCE = serviceApplication.IdentifierUris.First(); PCS_AUTH_CLIENT_APPID = clientApplication.AppId; PCS_AUTH_CLIENT_SECRET = clientApplicationSecret; PCS_AUTH_SERVICE_APPID = serviceApplication.AppId; PCS_AUTH_SERVICE_SECRET = serviceApplicationSecret; // CORS Whitelist PCS_CORS_WHITELIST = "*"; // Service URL path bases PCS_TWIN_REGISTRY_SERVICE_PATH_BASE = "/registry"; PCS_TWIN_SERVICE_PATH_BASE = "/twin"; PCS_HISTORY_SERVICE_PATH_BASE = "/history"; PCS_GATEWAY_SERVICE_PATH_BASE = "/ua"; PCS_VAULT_SERVICE_PATH_BASE = "/vault"; PCS_PUBLISHER_SERVICE_PATH_BASE = "/publisher"; PCS_PUBLISHER_ORCHESTRATOR_SERVICE_PATH_BASE = "/edge/publisher"; PCS_EVENTS_SERVICE_PATH_BASE = "/events"; PCS_FRONTEND_APP_SERVICE_PATH_BASE = "/frontend"; // AspNetCore ASPNETCORE_FORWARDEDHEADERS_ENABLED = $"{true}"; ASPNETCORE_FORWARDEDHEADERS_FORWARDLIMIT = $"{1}"; // OpenAPI PCS_OPENAPI_SERVER_HOST = ""; Dict = new Dictionary <string, string> { // IoT Hub { $"{nameof(PCS_IOTHUB_CONNSTRING)}", PCS_IOTHUB_CONNSTRING }, { $"{nameof(PCS_IOTHUB_EVENTHUBENDPOINT)}", PCS_IOTHUB_EVENTHUBENDPOINT }, { $"{nameof(PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_EVENTS)}", PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_EVENTS }, { $"{nameof(PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_TELEMETRY)}", PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_TELEMETRY }, { $"{nameof(PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_TUNNEL)}", PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_TUNNEL }, { $"{nameof(PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_ONBOARDING)}", PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_ONBOARDING }, // Cosmos DB { $"{nameof(PCS_COSMOSDB_CONNSTRING)}", PCS_COSMOSDB_CONNSTRING }, // Storage Account { $"{nameof(PCS_STORAGE_CONNSTRING)}", PCS_STORAGE_CONNSTRING }, { $"{nameof(PCS_STORAGE_CONTAINER_DATAPROTECTION)}", PCS_STORAGE_CONTAINER_DATAPROTECTION }, // ADLS Gen2 Storage Account { $"{nameof(PCS_ADLSG2_ACCOUNT)}", PCS_ADLSG2_ACCOUNT }, { $"{nameof(PCS_ADLSG2_ACCOUNT_KEY)}", PCS_ADLSG2_ACCOUNT_KEY }, { $"{nameof(PCS_ADLSG2_ENDPOINTSUFFIX)}", PCS_ADLSG2_ENDPOINTSUFFIX }, { $"{nameof(PCS_ADLSG2_CONNSTRING)}", PCS_ADLSG2_CONNSTRING }, { $"{nameof(PCS_ADLSG2_CONTAINER_CDM)}", PCS_ADLSG2_CONTAINER_CDM }, { $"{nameof(PCS_ADLSG2_CONTAINER_CDM_ROOTFOLDER)}", PCS_ADLSG2_CONTAINER_CDM_ROOTFOLDER }, // Event Hub Namespace { $"{nameof(PCS_EVENTHUB_CONNSTRING)}", PCS_EVENTHUB_CONNSTRING }, { $"{nameof(PCS_EVENTHUB_NAME)}", PCS_EVENTHUB_NAME }, { $"{nameof(PCS_EVENTHUB_CONSUMERGROUP_TELEMETRY_CDM)}", PCS_EVENTHUB_CONSUMERGROUP_TELEMETRY_CDM }, { $"{nameof(PCS_EVENTHUB_CONSUMERGROUP_TELEMETRY_UX)}", PCS_EVENTHUB_CONSUMERGROUP_TELEMETRY_UX }, // Service Bus { $"{nameof(PCS_SERVICEBUS_CONNSTRING)}", PCS_SERVICEBUS_CONNSTRING }, // Key Vault { $"{nameof(PCS_KEYVAULT_URL)}", PCS_KEYVAULT_URL }, { $"{nameof(PCS_KEYVAULT_KEY_DATAPROTECTION)}", PCS_KEYVAULT_KEY_DATAPROTECTION }, { $"{nameof(PCS_KEYVAULT_APPID)}", PCS_KEYVAULT_APPID }, { $"{nameof(PCS_KEYVAULT_SECRET)}", PCS_KEYVAULT_SECRET }, // Application Insights { $"{nameof(PCS_APPINSIGHTS_INSTRUMENTATIONKEY)}", PCS_APPINSIGHTS_INSTRUMENTATIONKEY }, // Log Analytics Workspace { $"{nameof(PCS_WORKSPACE_ID)}", PCS_WORKSPACE_ID }, { $"{nameof(PCS_WORKSPACE_KEY)}", PCS_WORKSPACE_KEY }, // Service URLs { $"{nameof(PCS_SERVICE_URL)}", PCS_SERVICE_URL }, // Service URLs that will be consumed by microservices. { $"{nameof(PCS_TWIN_REGISTRY_URL)}", PCS_TWIN_REGISTRY_URL }, { $"{nameof(PCS_TWIN_SERVICE_URL)}", PCS_TWIN_SERVICE_URL }, { $"{nameof(PCS_HISTORY_SERVICE_URL)}", PCS_HISTORY_SERVICE_URL }, { $"{nameof(PCS_VAULT_SERVICE_URL)}", PCS_VAULT_SERVICE_URL }, { $"{nameof(PCS_PUBLISHER_SERVICE_URL)}", PCS_PUBLISHER_SERVICE_URL }, { $"{nameof(PCS_PUBLISHER_ORCHESTRATOR_SERVICE_URL)}", PCS_PUBLISHER_ORCHESTRATOR_SERVICE_URL }, { $"{nameof(PCS_EVENTS_SERVICE_URL)}", PCS_EVENTS_SERVICE_URL }, // SignalR { $"{nameof(PCS_SIGNALR_CONNSTRING)}", PCS_SIGNALR_CONNSTRING }, { $"{nameof(PCS_SIGNALR_MODE)}", PCS_SIGNALR_MODE }, // Authentication { $"{nameof(PCS_AUTH_REQUIRED)}", PCS_AUTH_REQUIRED }, { $"{nameof(PCS_AUTH_TENANT)}", PCS_AUTH_TENANT }, { $"{nameof(PCS_AUTH_INSTANCE)}", PCS_AUTH_INSTANCE }, { $"{nameof(PCS_AUTH_ISSUER)}", PCS_AUTH_ISSUER }, { $"{nameof(PCS_AUTH_HTTPSREDIRECTPORT)}", PCS_AUTH_HTTPSREDIRECTPORT }, { $"{nameof(PCS_AUTH_AUDIENCE)}", PCS_AUTH_AUDIENCE }, { $"{nameof(PCS_AUTH_CLIENT_APPID)}", PCS_AUTH_CLIENT_APPID }, { $"{nameof(PCS_AUTH_CLIENT_SECRET)}", PCS_AUTH_CLIENT_SECRET }, { $"{nameof(PCS_AUTH_SERVICE_APPID)}", PCS_AUTH_SERVICE_APPID }, { $"{nameof(PCS_AUTH_SERVICE_SECRET)}", PCS_AUTH_SERVICE_SECRET }, // CORS Whitelist { $"{nameof(PCS_CORS_WHITELIST)}", PCS_CORS_WHITELIST }, // Service URL path bases { $"{nameof(PCS_TWIN_REGISTRY_SERVICE_PATH_BASE)}", PCS_TWIN_REGISTRY_SERVICE_PATH_BASE }, { $"{nameof(PCS_TWIN_SERVICE_PATH_BASE)}", PCS_TWIN_SERVICE_PATH_BASE }, { $"{nameof(PCS_HISTORY_SERVICE_PATH_BASE)}", PCS_HISTORY_SERVICE_PATH_BASE }, { $"{nameof(PCS_GATEWAY_SERVICE_PATH_BASE)}", PCS_GATEWAY_SERVICE_PATH_BASE }, { $"{nameof(PCS_VAULT_SERVICE_PATH_BASE)}", PCS_VAULT_SERVICE_PATH_BASE }, { $"{nameof(PCS_PUBLISHER_SERVICE_PATH_BASE)}", PCS_PUBLISHER_SERVICE_PATH_BASE }, { $"{nameof(PCS_PUBLISHER_ORCHESTRATOR_SERVICE_PATH_BASE)}", PCS_PUBLISHER_ORCHESTRATOR_SERVICE_PATH_BASE }, { $"{nameof(PCS_EVENTS_SERVICE_PATH_BASE)}", PCS_EVENTS_SERVICE_PATH_BASE }, { $"{nameof(PCS_FRONTEND_APP_SERVICE_PATH_BASE)}", PCS_FRONTEND_APP_SERVICE_PATH_BASE }, // AspNetCore { $"{nameof(ASPNETCORE_FORWARDEDHEADERS_ENABLED)}", ASPNETCORE_FORWARDEDHEADERS_ENABLED }, { $"{nameof(ASPNETCORE_FORWARDEDHEADERS_FORWARDLIMIT)}", ASPNETCORE_FORWARDEDHEADERS_FORWARDLIMIT }, // OpenAPI { $"{nameof(PCS_OPENAPI_SERVER_HOST)}", PCS_OPENAPI_SERVER_HOST }, }; }
public PSApplicationInsightsComponentTableView(ApplicationInsightsComponent component) : base(component) { }
public IIoTEnvironment( AzureEnvironment azureEnvironment, Guid tenantId, IotHubDescription iotHub, string iotHubOwnerConnectionString, string iotHubOnboardingConsumerGroupName, int iotHubEventHubEndpointsPartitionsCount, string cosmosDBAccountConnectionString, StorageAccountInner storageAccount, StorageAccountKey storageAccountKey, EventhubInner eventHub, string eventHubConnectionString, string serviceBusConnectionString, string signalRConnectionString, VaultInner keyVault, Workspace operationalInsightsWorkspace, ApplicationInsightsComponent applicationInsightsComponent, SiteInner webSite, Application serviceApplication, Application clientApplication ) { _HUB_CS = iotHubOwnerConnectionString; PCS_IOTHUB_CONNSTRING = iotHubOwnerConnectionString; // duplicate PCS_STORAGEADAPTER_DOCUMENTDB_CONNSTRING = cosmosDBAccountConnectionString; PCS_TELEMETRY_DOCUMENTDB_CONNSTRING = cosmosDBAccountConnectionString; // duplicate PCS_TELEMETRYAGENT_DOCUMENTDB_CONNSTRING = cosmosDBAccountConnectionString; // duplicate PCS_IOTHUBREACT_ACCESS_CONNSTRING = iotHubOwnerConnectionString; // duplicate PCS_IOTHUBREACT_HUB_NAME = iotHub.Name; PCS_IOTHUBREACT_HUB_ENDPOINT = iotHub.Properties.EventHubEndpoints["events"].Endpoint; PCS_IOTHUBREACT_HUB_CONSUMERGROUP = iotHubOnboardingConsumerGroupName; PCS_IOTHUBREACT_HUB_PARTITIONS = $"{iotHubEventHubEndpointsPartitionsCount}"; PCS_IOTHUBREACT_AZUREBLOB_ACCOUNT = storageAccount.Name; PCS_IOTHUBREACT_AZUREBLOB_KEY = storageAccountKey.Value; PCS_IOTHUBREACT_AZUREBLOB_ENDPOINT_SUFFIX = azureEnvironment.StorageEndpointSuffix; PCS_ASA_DATA_AZUREBLOB_ACCOUNT = PCS_IOTHUBREACT_AZUREBLOB_ACCOUNT; // duplicate PCS_ASA_DATA_AZUREBLOB_KEY = PCS_IOTHUBREACT_AZUREBLOB_KEY; // duplicate PCS_ASA_DATA_AZUREBLOB_ENDPOINT_SUFFIX = PCS_IOTHUBREACT_AZUREBLOB_ENDPOINT_SUFFIX; // duplicate PCS_EVENTHUB_CONNSTRING = eventHubConnectionString; PCS_EVENTHUB_NAME = eventHub.Name; PCS_SERVICEBUS_CONNSTRING = serviceBusConnectionString; PCS_KEYVAULT_URL = keyVault.Properties.VaultUri; PCS_WORKSPACE_NAME = operationalInsightsWorkspace.Name; PCS_APPINSIGHTS_NAME = applicationInsightsComponent.Name; PCS_APPINSIGHTS_INSTRUMENTATIONKEY = applicationInsightsComponent.InstrumentationKey; PCS_SERVICE_URL = $"https://{webSite.HostNames[0]}"; PCS_SIGNALR_CONNSTRING = signalRConnectionString; PCS_AUTH_HTTPSREDIRECTPORT = "0"; PCS_AUTH_REQUIRED = "true"; PCS_AUTH_AUDIENCE = serviceApplication.IdentifierUris.First(); PCS_AUTH_ISSUER = $"https://sts.windows.net/{tenantId.ToString()}/"; PCS_WEBUI_AUTH_AAD_APPID = clientApplication.AppId; PCS_WEBUI_AUTH_AAD_AUTHORITY = azureEnvironment.AuthenticationEndpoint; PCS_WEBUI_AUTH_AAD_TENANT = tenantId.ToString(); PCS_CORS_WHITELIST = "*"; REACT_APP_PCS_AUTH_REQUIRED = PCS_AUTH_REQUIRED; // duplicate REACT_APP_PCS_AUTH_AUDIENCE = PCS_AUTH_AUDIENCE; // duplicate REACT_APP_PCS_AUTH_ISSUER = PCS_AUTH_ISSUER; // duplicate REACT_APP_PCS_WEBUI_AUTH_AAD_APPID = PCS_WEBUI_AUTH_AAD_APPID; // duplicate REACT_APP_PCS_WEBUI_AUTH_AAD_AUTHORITY = PCS_WEBUI_AUTH_AAD_AUTHORITY; // duplicate REACT_APP_PCS_WEBUI_AUTH_AAD_TENANT = PCS_WEBUI_AUTH_AAD_TENANT; // duplicate Dict = new Dictionary <string, string> { { "_HUB_CS", _HUB_CS }, { "PCS_IOTHUB_CONNSTRING", PCS_IOTHUB_CONNSTRING }, { "PCS_STORAGEADAPTER_DOCUMENTDB_CONNSTRING", PCS_STORAGEADAPTER_DOCUMENTDB_CONNSTRING }, { "PCS_TELEMETRY_DOCUMENTDB_CONNSTRING", PCS_TELEMETRY_DOCUMENTDB_CONNSTRING }, { "PCS_TELEMETRYAGENT_DOCUMENTDB_CONNSTRING", PCS_TELEMETRYAGENT_DOCUMENTDB_CONNSTRING }, { "PCS_IOTHUBREACT_ACCESS_CONNSTRING", PCS_IOTHUBREACT_ACCESS_CONNSTRING }, { "PCS_IOTHUBREACT_HUB_NAME", PCS_IOTHUBREACT_HUB_NAME }, { "PCS_IOTHUBREACT_HUB_ENDPOINT", PCS_IOTHUBREACT_HUB_ENDPOINT }, { "PCS_IOTHUBREACT_HUB_CONSUMERGROUP", PCS_IOTHUBREACT_HUB_CONSUMERGROUP }, { "PCS_IOTHUBREACT_HUB_PARTITIONS", PCS_IOTHUBREACT_HUB_PARTITIONS }, { "PCS_IOTHUBREACT_AZUREBLOB_ACCOUNT", PCS_IOTHUBREACT_AZUREBLOB_ACCOUNT }, { "PCS_IOTHUBREACT_AZUREBLOB_KEY", PCS_IOTHUBREACT_AZUREBLOB_KEY }, { "PCS_IOTHUBREACT_AZUREBLOB_ENDPOINT_SUFFIX", PCS_IOTHUBREACT_AZUREBLOB_ENDPOINT_SUFFIX }, { "PCS_ASA_DATA_AZUREBLOB_ACCOUNT", PCS_ASA_DATA_AZUREBLOB_ACCOUNT }, { "PCS_ASA_DATA_AZUREBLOB_KEY", PCS_ASA_DATA_AZUREBLOB_KEY }, { "PCS_ASA_DATA_AZUREBLOB_ENDPOINT_SUFFIX", PCS_ASA_DATA_AZUREBLOB_ENDPOINT_SUFFIX }, { "PCS_EVENTHUB_CONNSTRING", PCS_EVENTHUB_CONNSTRING }, { "PCS_EVENTHUB_NAME", PCS_EVENTHUB_NAME }, { "PCS_SERVICEBUS_CONNSTRING", PCS_SERVICEBUS_CONNSTRING }, { "PCS_KEYVAULT_URL", PCS_KEYVAULT_URL }, { "PCS_WORKSPACE_NAME", PCS_WORKSPACE_NAME }, { "PCS_APPINSIGHTS_NAME", PCS_APPINSIGHTS_NAME }, { "PCS_APPINSIGHTS_INSTRUMENTATIONKEY", PCS_APPINSIGHTS_INSTRUMENTATIONKEY }, { "PCS_SERVICE_URL", PCS_SERVICE_URL }, { "PCS_SIGNALR_CONNSTRING", PCS_SIGNALR_CONNSTRING }, { "PCS_AUTH_HTTPSREDIRECTPORT", PCS_AUTH_HTTPSREDIRECTPORT }, { "PCS_AUTH_REQUIRED", PCS_AUTH_REQUIRED }, { "PCS_AUTH_AUDIENCE", PCS_AUTH_AUDIENCE }, { "PCS_AUTH_ISSUER", PCS_AUTH_ISSUER }, { "PCS_WEBUI_AUTH_AAD_APPID", PCS_WEBUI_AUTH_AAD_APPID }, { "PCS_WEBUI_AUTH_AAD_AUTHORITY", PCS_WEBUI_AUTH_AAD_AUTHORITY }, { "PCS_WEBUI_AUTH_AAD_TENANT", PCS_WEBUI_AUTH_AAD_TENANT }, { "PCS_CORS_WHITELIST", PCS_CORS_WHITELIST }, { "REACT_APP_PCS_AUTH_REQUIRED", REACT_APP_PCS_AUTH_REQUIRED }, { "REACT_APP_PCS_AUTH_AUDIENCE", REACT_APP_PCS_AUTH_AUDIENCE }, { "REACT_APP_PCS_AUTH_ISSUER", REACT_APP_PCS_AUTH_ISSUER }, { "REACT_APP_PCS_WEBUI_AUTH_AAD_APPID", REACT_APP_PCS_WEBUI_AUTH_AAD_APPID }, { "REACT_APP_PCS_WEBUI_AUTH_AAD_AUTHORITY", REACT_APP_PCS_WEBUI_AUTH_AAD_AUTHORITY }, { "REACT_APP_PCS_WEBUI_AUTH_AAD_TENANT", REACT_APP_PCS_WEBUI_AUTH_AAD_TENANT } }; }
public void CreateGetListUpdateDeleteComponents() { using (MockContext context = MockContext.Start(this.GetType().FullName)) { ApplicationInsightsComponent bodyParameter = GetCreateComponentProperties(nameof(CreateGetListUpdateDeleteComponents)); var insightsClient = GetAppInsightsManagementClient(context, handler); //"create new component"; var createdComponentResponse = insightsClient .Components .CreateOrUpdateWithHttpMessagesAsync( ResourceGroupName, nameof(CreateGetListUpdateDeleteComponents), insightProperties: bodyParameter) .GetAwaiter() .GetResult(); //verify Assert.Equal(bodyParameter.Name, createdComponentResponse.Body.Name); Assert.Equal(bodyParameter.RequestSource, createdComponentResponse.Body.RequestSource); Assert.Equal(bodyParameter.FlowType, createdComponentResponse.Body.FlowType); Assert.Equal(bodyParameter.Kind, createdComponentResponse.Body.Kind); //list all components var listAllComponentsResponse = insightsClient .Components .ListWithHttpMessagesAsync() .GetAwaiter() .GetResult(); //verify Assert.True(listAllComponentsResponse.Body.Count() > 0); //list components inside inside a group var listComponentsResponse = insightsClient .Components .ListByResourceGroupWithHttpMessagesAsync(ResourceGroupName) .GetAwaiter() .GetResult(); //verify Assert.True(listComponentsResponse.Body.Count() > 0); var component = listComponentsResponse.Body.FirstOrDefault(c => c.Name == bodyParameter.Name); Assert.True(component != null); //get back component var getComponentResponse = insightsClient .Components .GetWithHttpMessagesAsync(ResourceGroupName, nameof(CreateGetListUpdateDeleteComponents)) .GetAwaiter() .GetResult(); //verify Assert.True(getComponentResponse.Body != null); Assert.Equal(getComponentResponse.Body.Name, bodyParameter.Name); //update component bodyParameter = GetUpdateComponentProperties(); var updateComponentResponse = insightsClient .Components .CreateOrUpdateWithHttpMessagesAsync( ResourceGroupName, nameof(CreateGetListUpdateDeleteComponents), bodyParameter) .GetAwaiter() .GetResult(); //verify Assert.Equal(bodyParameter.Name, updateComponentResponse.Body.Name); Assert.Equal(bodyParameter.RequestSource, updateComponentResponse.Body.RequestSource); Assert.Equal(bodyParameter.FlowType, updateComponentResponse.Body.FlowType); Assert.Equal(bodyParameter.Kind, updateComponentResponse.Body.Kind); //delete component var deleteComponentResponse = insightsClient .Components .DeleteWithHttpMessagesAsync( ResourceGroupName, nameof(CreateGetListUpdateDeleteComponents)) .GetAwaiter() .GetResult(); //get component again, should get an exception Assert.Throws <CloudException>(() => { getComponentResponse = insightsClient .Components .GetWithHttpMessagesAsync(ResourceGroupName, nameof(CreateGetListUpdateDeleteComponents)) .GetAwaiter() .GetResult(); }); } }
/// <summary> /// Creates (or updates) an Application Insights component. Note: You cannot /// specify a different value for InstrumentationKey nor AppId in the Put /// operation. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. The name is case insensitive. /// </param> /// <param name='resourceName'> /// The name of the Application Insights component resource. /// </param> /// <param name='insightProperties'> /// Properties that need to be specified to create an Application Insights /// component. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ApplicationInsightsComponent> CreateOrUpdateAsync(this IComponentsOperations operations, string resourceGroupName, string resourceName, ApplicationInsightsComponent insightProperties, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, insightProperties, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Creates (or updates) an Application Insights component. Note: You cannot /// specify a different value for InstrumentationKey nor AppId in the Put /// operation. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. The name is case insensitive. /// </param> /// <param name='resourceName'> /// The name of the Application Insights component resource. /// </param> /// <param name='insightProperties'> /// Properties that need to be specified to create an Application Insights /// component. /// </param> public static ApplicationInsightsComponent CreateOrUpdate(this IComponentsOperations operations, string resourceGroupName, string resourceName, ApplicationInsightsComponent insightProperties) { return(operations.CreateOrUpdateAsync(resourceGroupName, resourceName, insightProperties).GetAwaiter().GetResult()); }
public IIoTEnvironment( AzureEnvironment azureEnvironment, Guid tenantId, // IoT Hub IotHubDescription iotHub, string iotHubOwnerConnectionString, string iotHubEventHubEventsEndpointName, EventHubConsumerGroupInfo iotHubEventHubEventsConsumerGroup, EventHubConsumerGroupInfo iotHubEventHubTelemetryConsumerGroup, // Cosmos DB string cosmosDBAccountConnectionString, // Storage Account string storageAccountConectionString, string storageAccountContainerDataprotection, // ADLS Gen2 Storage Account string adlsConectionString, string adlsContainerCdm, string adlsContainerCdmRootFolder, // Event Hub Namespace EventhubInner eventHub, string eventHubConnectionString, ConsumerGroupInner telemetryCdm, ConsumerGroupInner telemetryUx, // Service Bus string serviceBusConnectionString, // SignalR string signalRConnectionString, // Key Vault VaultInner keyVault, string dataprotectionKeyName, // Application Insights ApplicationInsightsComponent applicationInsightsComponent, string serviceURL, Application serviceApplication, string serviceApplicationSecret, Application clientApplication, string clientApplicationSecret ) { // IoT Hub PCS_IOTHUB_CONNSTRING = iotHubOwnerConnectionString; PCS_IOTHUB_EVENTHUBENDPOINT = iotHub.Properties.EventHubEndpoints[iotHubEventHubEventsEndpointName].Endpoint; PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_EVENTS = iotHubEventHubEventsConsumerGroup.Name; PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_TELEMETRY = iotHubEventHubTelemetryConsumerGroup.Name; // Cosmos DB PCS_COSMOSDB_CONNSTRING = cosmosDBAccountConnectionString; // Storage Account PCS_STORAGE_CONNSTRING = storageAccountConectionString; PCS_STORAGE_CONTAINER_DATAPROTECTION = storageAccountContainerDataprotection; // ADLS Gen2 Storage Account PCS_ADLSG2_CONNSTRING = adlsConectionString; PCS_ADLSG2_CONTAINER_CDM = adlsContainerCdm; PCS_ADLSG2_CONTAINER_CDM_ROOTFOLDER = adlsContainerCdmRootFolder; // Event Hub Namespace PCS_EVENTHUB_CONNSTRING = eventHubConnectionString; PCS_EVENTHUB_NAME = eventHub.Name; PCS_EVENTHUB_CONSUMERGROUP_TELEMETRY_CDM = telemetryCdm.Name; PCS_EVENTHUB_CONSUMERGROUP_TELEMETRY_UX = telemetryUx.Name; // Service Bus PCS_SERVICEBUS_CONNSTRING = serviceBusConnectionString; // Key Vault PCS_KEYVAULT_URL = keyVault.Properties.VaultUri; PCS_KEYVAULT_KEY_DATAPROTECTION = dataprotectionKeyName; PCS_KEYVAULT_APPID = serviceApplication.AppId; PCS_KEYVAULT_SECRET = serviceApplicationSecret; // Application Insights PCS_APPINSIGHTS_INSTRUMENTATIONKEY = applicationInsightsComponent.InstrumentationKey; // Service URLs PCS_SERVICE_URL = serviceURL; var iiotNamespace = "industrial-iot"; // AKS internal service URLs PCS_TWIN_REGISTRY_URL_INTERNAL = $"http://{"registry-service"}.{iiotNamespace}:{9042}"; PCS_TWIN_SERVICE_URL_INTERNAL = $"http://{"twin-service"}.{iiotNamespace}:{9041}"; PCS_HISTORY_SERVICE_URL_INTERNAL = $"http://{"history-service"}.{iiotNamespace}:{9043}"; PCS_VAULT_SERVICE_URL_INTERNAL = $"http://{"vault-service"}.{iiotNamespace}:{9044}"; PCS_PUBLISHER_SERVICE_URL_INTERNAL = $"http://{"publisher-service"}.{iiotNamespace}:{9045}"; PCS_PUBLISHER_ORCHESTRATOR_SERVICE_URL_INTERNAL = $"http://{"edge-jobs-service"}.{iiotNamespace}:{9051}"; PCS_EVENTS_SERVICE_URL_INTERNAL = $"http://{"events-service"}.{iiotNamespace}:{9050}"; // Externally accessible service URLs serviceURL = serviceURL.TrimEnd('/'); PCS_TWIN_REGISTRY_URL_EXTERNAL = $"{serviceURL}/registry/"; PCS_TWIN_SERVICE_URL_EXTERNAL = $"{serviceURL}/twin/"; PCS_HISTORY_SERVICE_URL_EXTERNAL = $"{serviceURL}/history/"; PCS_VAULT_SERVICE_URL_EXTERNAL = $"{serviceURL}/vault/"; PCS_PUBLISHER_SERVICE_URL_EXTERNAL = $"{serviceURL}/publisher/"; PCS_PUBLISHER_ORCHESTRATOR_SERVICE_URL_EXTERNAL = $"{serviceURL}/edge/publisher/"; PCS_EVENTS_SERVICE_URL_EXTERNAL = $"{serviceURL}/events/"; // Service URLs that will be consumed by microservices. PCS_TWIN_REGISTRY_URL = PCS_TWIN_REGISTRY_URL_INTERNAL; PCS_TWIN_SERVICE_URL = PCS_TWIN_SERVICE_URL_INTERNAL; PCS_HISTORY_SERVICE_URL = PCS_HISTORY_SERVICE_URL_INTERNAL; PCS_VAULT_SERVICE_URL = PCS_VAULT_SERVICE_URL_INTERNAL; PCS_PUBLISHER_SERVICE_URL = PCS_PUBLISHER_SERVICE_URL_INTERNAL; // NOTE: PCS_PUBLISHER_ORCHESTRATOR_SERVICE_URL should be externally accessible URL. PCS_PUBLISHER_ORCHESTRATOR_SERVICE_URL = PCS_PUBLISHER_ORCHESTRATOR_SERVICE_URL_EXTERNAL; PCS_EVENTS_SERVICE_URL = PCS_EVENTS_SERVICE_URL_INTERNAL; // SignalR PCS_SIGNALR_CONNSTRING = signalRConnectionString; // Authentication PCS_AUTH_REQUIRED = $"{true}"; PCS_AUTH_TENANT = $"{tenantId}"; // ToDo: Check value of PCS_AUTH_INSTANCE. //PCS_AUTH_INSTANCE = "https://login.microsoftonline.com/"; PCS_AUTH_INSTANCE = azureEnvironment.AuthenticationEndpoint; PCS_AUTH_ISSUER = $"https://sts.windows.net/{tenantId}/"; PCS_AUTH_HTTPSREDIRECTPORT = $"{0}"; PCS_AUTH_AUDIENCE = serviceApplication.IdentifierUris.First(); PCS_AUTH_CLIENT_APPID = clientApplication.AppId; PCS_AUTH_CLIENT_SECRET = clientApplicationSecret; PCS_AUTH_SERVICE_APPID = serviceApplication.AppId; PCS_AUTH_SERVICE_SECRET = serviceApplicationSecret; // CORS Whitelist PCS_CORS_WHITELIST = "*"; // Service URL path bases PCS_TWIN_REGISTRY_SERVICE_PATH_BASE = "/registry"; PCS_TWIN_SERVICE_PATH_BASE = "/twin"; PCS_HISTORY_SERVICE_PATH_BASE = "/history"; PCS_GATEWAY_SERVICE_PATH_BASE = "/ua"; PCS_VAULT_SERVICE_PATH_BASE = "/vault"; PCS_PUBLISHER_SERVICE_PATH_BASE = "/publisher"; PCS_EVENTS_SERVICE_PATH_BASE = "/events"; PCS_FRONTEND_APP_SERVICE_PATH_BASE = "/frontend"; PCS_PUBLISHER_ORCHESTRATOR_SERVICE_PATH_BASE = "/edge/publisher"; // AspNetCore ASPNETCORE_FORWARDEDHEADERS_ENABLED = $"{true}"; ASPNETCORE_FORWARDEDHEADERS_FORWARDLIMIT = $"{1}"; // OpenAPI PCS_OPENAPI_SERVER_HOST = ""; Dict = new Dictionary <string, string> { // IoT Hub { $"{nameof(PCS_IOTHUB_CONNSTRING)}", PCS_IOTHUB_CONNSTRING }, { $"{nameof(PCS_IOTHUB_EVENTHUBENDPOINT)}", PCS_IOTHUB_EVENTHUBENDPOINT }, { $"{nameof(PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_EVENTS)}", PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_EVENTS }, { $"{nameof(PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_TELEMETRY)}", PCS_IOTHUB_EVENTHUB_CONSUMER_GROUP_TELEMETRY }, // Cosmos DB { $"{nameof(PCS_COSMOSDB_CONNSTRING)}", PCS_COSMOSDB_CONNSTRING }, // Storage Account { $"{nameof(PCS_STORAGE_CONNSTRING)}", PCS_STORAGE_CONNSTRING }, { $"{nameof(PCS_STORAGE_CONTAINER_DATAPROTECTION)}", PCS_STORAGE_CONTAINER_DATAPROTECTION }, // ADLS Gen2 Storage Account { $"{nameof(PCS_ADLSG2_CONNSTRING)}", PCS_ADLSG2_CONNSTRING }, { $"{nameof(PCS_ADLSG2_CONTAINER_CDM)}", PCS_ADLSG2_CONTAINER_CDM }, { $"{nameof(PCS_ADLSG2_CONTAINER_CDM_ROOTFOLDER)}", PCS_ADLSG2_CONTAINER_CDM_ROOTFOLDER }, // Event Hub Namespace { $"{nameof(PCS_EVENTHUB_CONNSTRING)}", PCS_EVENTHUB_CONNSTRING }, { $"{nameof(PCS_EVENTHUB_NAME)}", PCS_EVENTHUB_NAME }, { $"{nameof(PCS_EVENTHUB_CONSUMERGROUP_TELEMETRY_CDM)}", PCS_EVENTHUB_CONSUMERGROUP_TELEMETRY_CDM }, { $"{nameof(PCS_EVENTHUB_CONSUMERGROUP_TELEMETRY_UX)}", PCS_EVENTHUB_CONSUMERGROUP_TELEMETRY_UX }, // Service Bus { $"{nameof(PCS_SERVICEBUS_CONNSTRING)}", PCS_SERVICEBUS_CONNSTRING }, // Key Vault { $"{nameof(PCS_KEYVAULT_URL)}", PCS_KEYVAULT_URL }, { $"{nameof(PCS_KEYVAULT_KEY_DATAPROTECTION)}", PCS_KEYVAULT_KEY_DATAPROTECTION }, { $"{nameof(PCS_KEYVAULT_APPID)}", PCS_KEYVAULT_APPID }, { $"{nameof(PCS_KEYVAULT_SECRET)}", PCS_KEYVAULT_SECRET }, // Application Insights { $"{nameof(PCS_APPINSIGHTS_INSTRUMENTATIONKEY)}", PCS_APPINSIGHTS_INSTRUMENTATIONKEY }, // Service URLs { $"{nameof(PCS_SERVICE_URL)}", PCS_SERVICE_URL }, { $"{nameof(PCS_TWIN_REGISTRY_URL)}", PCS_TWIN_REGISTRY_URL }, { $"{nameof(PCS_TWIN_SERVICE_URL)}", PCS_TWIN_SERVICE_URL }, { $"{nameof(PCS_HISTORY_SERVICE_URL)}", PCS_HISTORY_SERVICE_URL }, { $"{nameof(PCS_VAULT_SERVICE_URL)}", PCS_VAULT_SERVICE_URL }, { $"{nameof(PCS_PUBLISHER_SERVICE_URL)}", PCS_PUBLISHER_SERVICE_URL }, { $"{nameof(PCS_PUBLISHER_ORCHESTRATOR_SERVICE_URL)}", PCS_PUBLISHER_ORCHESTRATOR_SERVICE_URL }, { $"{nameof(PCS_EVENTS_SERVICE_URL)}", PCS_EVENTS_SERVICE_URL }, // SignalR { $"{nameof(PCS_SIGNALR_CONNSTRING)}", PCS_SIGNALR_CONNSTRING }, // Authentication { $"{nameof(PCS_AUTH_REQUIRED)}", PCS_AUTH_REQUIRED }, { $"{nameof(PCS_AUTH_TENANT)}", PCS_AUTH_TENANT }, { $"{nameof(PCS_AUTH_INSTANCE)}", PCS_AUTH_INSTANCE }, { $"{nameof(PCS_AUTH_ISSUER)}", PCS_AUTH_ISSUER }, { $"{nameof(PCS_AUTH_HTTPSREDIRECTPORT)}", PCS_AUTH_HTTPSREDIRECTPORT }, { $"{nameof(PCS_AUTH_AUDIENCE)}", PCS_AUTH_AUDIENCE }, { $"{nameof(PCS_AUTH_CLIENT_APPID)}", PCS_AUTH_CLIENT_APPID }, { $"{nameof(PCS_AUTH_CLIENT_SECRET)}", PCS_AUTH_CLIENT_SECRET }, { $"{nameof(PCS_AUTH_SERVICE_APPID)}", PCS_AUTH_SERVICE_APPID }, { $"{nameof(PCS_AUTH_SERVICE_SECRET)}", PCS_AUTH_SERVICE_SECRET }, // CORS Whitelist { $"{nameof(PCS_CORS_WHITELIST)}", PCS_CORS_WHITELIST }, // Service URL path bases { $"{nameof(PCS_TWIN_REGISTRY_SERVICE_PATH_BASE)}", PCS_TWIN_REGISTRY_SERVICE_PATH_BASE }, { $"{nameof(PCS_TWIN_SERVICE_PATH_BASE)}", PCS_TWIN_SERVICE_PATH_BASE }, { $"{nameof(PCS_HISTORY_SERVICE_PATH_BASE)}", PCS_HISTORY_SERVICE_PATH_BASE }, { $"{nameof(PCS_GATEWAY_SERVICE_PATH_BASE)}", PCS_GATEWAY_SERVICE_PATH_BASE }, { $"{nameof(PCS_VAULT_SERVICE_PATH_BASE)}", PCS_VAULT_SERVICE_PATH_BASE }, { $"{nameof(PCS_PUBLISHER_SERVICE_PATH_BASE)}", PCS_PUBLISHER_SERVICE_PATH_BASE }, { $"{nameof(PCS_EVENTS_SERVICE_PATH_BASE)}", PCS_EVENTS_SERVICE_PATH_BASE }, { $"{nameof(PCS_FRONTEND_APP_SERVICE_PATH_BASE)}", PCS_FRONTEND_APP_SERVICE_PATH_BASE }, { $"{nameof(PCS_PUBLISHER_ORCHESTRATOR_SERVICE_PATH_BASE)}", PCS_PUBLISHER_ORCHESTRATOR_SERVICE_PATH_BASE }, // AspNetCore { $"{nameof(ASPNETCORE_FORWARDEDHEADERS_ENABLED)}", ASPNETCORE_FORWARDEDHEADERS_ENABLED }, { $"{nameof(ASPNETCORE_FORWARDEDHEADERS_FORWARDLIMIT)}", ASPNETCORE_FORWARDEDHEADERS_FORWARDLIMIT }, // OpenAPI { $"{nameof(PCS_OPENAPI_SERVER_HOST)}", PCS_OPENAPI_SERVER_HOST }, }; }
public async Task <ApplicationInsightsComponent> CreateApplicationInsightsComponentAsync( IResourceGroup resourceGroup, string applicationInsightsName, IDictionary <string, string> tags = null, CancellationToken cancellationToken = default ) { try { tags ??= new Dictionary <string, string>(); Log.Information($"Creating Azure Application Insights Component: {applicationInsightsName} ..."); var applicationInsightsComponentParameters = new ApplicationInsightsComponent() { Location = resourceGroup.RegionName, Tags = tags, Kind = APPLICATION_INSIGHTS_COMPONENT_KIND, ApplicationType = APPLICATION_INSIGHTS_COMPONENT_APPLICATION_TYPE }; applicationInsightsComponentParameters.Validate(); var applicationInsightsComponent = await _applicationInsightsManagementClient .Components .CreateOrUpdateAsync( resourceGroup.Name, applicationInsightsName, applicationInsightsComponentParameters, cancellationToken ); var applicationInsightsComponentBillingFeaturesParameters = new ApplicationInsightsComponentBillingFeatures() { CurrentBillingFeatures = new List <string> { "Basic" }, // ResetTime is get only, so not available through object initializers DataVolumeCap = new ApplicationInsightsComponentDataVolumeCap( cap: 100.0, resetTime: 24, warningThreshold: 90 ) }; var applicationInsightsComponentBillingFeatures = await _applicationInsightsManagementClient .ComponentCurrentBillingFeatures .UpdateAsync( resourceGroup.Name, applicationInsightsName, applicationInsightsComponentBillingFeaturesParameters, cancellationToken ); Log.Information($"Created Azure Application Insights Component: {applicationInsightsName}"); return(applicationInsightsComponent); } catch (Exception ex) { Log.Error(ex, $"Failed to create Azure Application Insights Component: {applicationInsightsName}"); throw; } }
public static PSApplicationInsightsComponent Create(ApplicationInsightsComponent component) { var result = new PSApplicationInsightsComponent(component); return(result); }