How do I make APIManagement Service Logger deploy before the Application insights Resource? - api

I am trying to make the following ARM deploy a APIM service logger, however the service logger starts to deploy before the app insights resource and fails, the app insights resource is in a seperate template. I have added a dependson statement and thought that would do the job but that did'nt work either. Also the code below actually works if the app insights is already deployed.
does anyone have any pointers?
{
"type": "Microsoft.ApiManagement/service/loggers",
"name": "[concat(variables('apiManagementInstanceName'), '/', parameters('appInsightsName'))]",
"apiVersion": "2018-01-01",
"properties": {
"loggerType": "applicationInsights",
"description": "Logger resources to APIM",
"credentials": {
"instrumentationKey": "[reference(resourceId('Microsoft.Insights/components', parameters('appInsightsName')), '2015-05-01').InstrumentationKey]"
}
}
"dependsOn": [
"[resourceId('microsoft.insights/components', parameters('appInsightsName'))]"
]
}
also tried depending on both the APIM and app insights
"dependsOn": [
//"[resourceId('Microsoft.ApiManagement/service', variables('apiManagementInstanceName'))]"
"[resourceId('microsoft.insights/components', parameters('appInsightsName'))]"
],

You can use linked templates to reference another template file and define dependencies on it: https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/linked-templates#linked-template

Related

How to apply 'out of the box' Cumulocity Widgets (such as 'Radial Gauge') in custom Cumulocity applications

So I've been trying to make a customised application in Cumulocity. However, I want to maintain the consistency for cockpit and my customised application, so I'm just wondering is there any way to apply the "out of the box" widgets to our own application?
Thanks
You can achieve that through the manifest file in your application (cumulocity.json). Just list the plugins you want to include into your custom application.
{
"availability": "MARKET",
"contextPath": "charts",
"key": "charts-app-key",
"name": "Charts",
"resourcesUrl": "/",
"type": "HOSTED",
"imports": [
"core/c8yBranding",
"charts/dygraphsHour",
"charts/dygraphsTenMin",
"administration/alarmMapping"
]
}
You can list all the imports of a default application using the CLI tool.
c8y util:showimports cockpit
If you want to have the full cockpit application and just add you plugins it might be easier to use the target files:
{
"name": "Training",
"comment": "Release with additional example plugins",
"applications": [
{
"contextPath": "cockpit",
"addImports": [ "charts/dygraphsHour", "core/c8yBranding"]
}
]
}
This will use the full cockpit and just adds the wo plugins listed. It will replace your default cockpit with your extended one.

How do I automate adding a custom Iot Hub Endpoint (and route to it)?

In order to receive Azure IotHub Device Twin change notifications, it appears that it's necessary to create a custom endpoint and create a route to send notifications to that endpoint. This seems straightforward enough on the Azure Portal, but as one might expect we want to automate it.
I haven't been able to find any documentation for the the az cli or even the REST API, though I might have missed something. I didn't find anything promising looking in the SDKs either.
How do I automate adding a custom endpoint and then setting up the route for device twin notifications?
You can check IotHubs template to see if it helps.
Route:
"routing": {
"endpoints": {
"serviceBusQueues": [
{
"connectionString": "string",
"name": "string",
"subscriptionId": "string",
"resourceGroup": "string"
}
]
},
"routes": [
{
"name": "string",
"source": "string",
"condition": "string",
"endpointNames": [
"string"
],
"isEnabled": boolean
}
],
Consumer group:
{
"apiVersion": "2016-02-03",
"type": "Microsoft.Devices/IotHubs/eventhubEndpoints/ConsumerGroups",
"name": "[concat(parameters('hubName'), '/events/cg1')]",
"dependsOn": [
"[concat('Microsoft.Devices/Iothubs/', parameters('hubName'))]"
]
},
For more detailed information you can reference:
Microsoft.Devices/IotHubs template reference
Create an IoT hub using Azure Resource Manager template (PowerShell)

Set a custom domain for an azure Storage Account through an ARM template

I'm trying to setup an ARM template to set a custom domain for an Azure storage account. I am only running this portion of my ARM template after the storage account is initially setup and a DNS record has been created, but it still fails with this error:
: The custom domain name could not be verified. CNAME mapping from myStorage.mydomain.com to .blob.core.windows.net does not exist.
I've replaced my domain in the error, but the rest is exact. I notice that it looks suspicious since it doesn't list the name of my storage account, but the storage account is named, so I can't figure out how to affect that. Here's the resource definition (again, the account name and domain are replaced, but all else is the same)
"resources": [
{
"name": "myStorageAccount",
"type": "Microsoft.Storage/storageAccounts",
"location": "[resourceGroup().location]",
"apiVersion": "2017-06-01",
"sku": {
"name": "Standard_LRS"
},
"dependsOn": [],
"tags": {
"displayName": "Storage Account"
},
"kind": "BlobStorage",
"properties":{
"customDomain":{
"name":"myStorage.mydomain.com",
"useSubDomain":false
}
}
}
]
I can set it to the same custom domain through the Azure portal. It validates fine there. I'm sure I could do it through a separate PowerShell script, but I prefer to do it in the ARM, so as to minimize the need for additional scripts when setting up my environment.
Any thoughts would be appreciated.

RequireJS script error when requiring "ReleaseaManagement/Core/RestClient" on TFS 2015 and 2017

I'm creating an tfs hub Extension (2015/2017) and need to read the projects' release defs and create releases also. I know, I could make direkt Rest Calls instead of using the methods of the rest clients. But they seem more comfortable to me.
When I try to get the Restmanagement RestClient, I get:
Script error for: ReleaseManagement/Core/RestClient
http://requirejs.org/docs/errors.html#scripterror
In both TFS.2015.2 and TFS.2017
Doesn't the client yet exist on-premise?
You can refer to this article for how to use Rest API in extension to read a release definition: Writing a ReleaseManagement extension for cloning an existing release definition.
The code to read a release definition:
VSS.require(["VSS/Controls", "VSS/Service", "ReleaseManagement/Core/RestClient"],
var rmClient = VSS_Service.getCollectionClient(RM_WebApi.ReleaseHttpClient);
rmClient.getReleaseDefinition(vsoContext.project.id,sourceItemContext.definition.id);
And if you are using typescript, you need to include "ms.vss-releaseManagement-web.release-service-data-external" in the contribution like following:
"contributions": [
{
"id": "release-status",
"type": "ms.vss-web.hub",
"includes": [ "ms.vss-releaseManagement-web.release-service-data-external" ],
"description": "A hub to show release status",
"targets": [
"ms.vss-work-web.work-hub-group"
],
"properties": {
"name": "hello",
"order": 99,
"uri": "app.html"
}
}
]

Settings for hosting an application in cumulocity

i want to configure the application to be hosted at cumulocity via uploaded archives.
The documentation shows two application types, HOSTED and EXTERNAL.
If i set the type to HOSTED, it requires the params resourcesUrl, which references a repository.
What steps are required to create an application with plugins,
which is hosted at cumulocity and not from a repository?
cumulocity.json
{
"availability": "PRIVATE",
"contextPath": "appContextPath",
"key": "appKey",
"name": "appName",
"type": "HOSTED",
"resourcesUrl": "appResourceUrl",
"imports": [
"core/c8yBranding",
"core/deviceList",
"appKey/plugin",
"devicemanagement/deviceRegistration",
"devicemanagement/measurements",
"devicemanagement/groupsHierarchy",
"devicemanagement/location",
"devicemanagement/deviceGroupList",
"devicemanagement/deviceListMap",
"devicemanagement/logViewer"
]
}
For HOSTED applications uploaded as ZIP files the valid resourcesURL would be "/".