Skip to content

Instantly share code, notes, and snippets.

View Geertvdc's full-sized avatar
🌩️
Build it, Run it, Break it, Fix it, Own it!

Geert van der Cruijsen Geertvdc

🌩️
Build it, Run it, Break it, Fix it, Own it!
View GitHub Profile
@Geertvdc
Geertvdc / azure-pipelines.yml
Created October 20, 2018 19:00
basic azure pipeline yaml
pool:
vmImage: 'Ubuntu 16.04'
variables:
buildConfiguration: 'Release'
steps:
- script: |
cd ContainerizedBuildSample
dotnet build --configuration $(buildConfiguration)
@Geertvdc
Geertvdc / ci-settings.xml
Created August 8, 2018 13:03
Maven ci-settings.xml with Nexus user/pw
<?xml version="1.0"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0">
<servers>
<server>
<id>YOUR REPOSITORY ID</id>
<username>${nexusUser}</username>
<password>${nexusPassword}</password>
</server>
</servers>
</settings>
@Geertvdc
Geertvdc / assignRegisterResourcesRole.ps1
Created March 21, 2018 11:02
az role definition create + assign
az role definition create --role-definition @registerResources.json
#assign the role to a AD group containing all your users
az role assignment create --assignee "All Azure Users" --role "Register Azure resource providers"
@Geertvdc
Geertvdc / Register Azure resource providers.json
Last active March 21, 2018 10:51
Register Azure resource providers role in Azure
{
"Name": "Register Azure resource providers",
"Description": "Can register Azure resource providers",
"Actions": [ "*/register/action" ],
"AssignableScopes": [
"/subscriptions/[YOUR_SUBSCRIPTIONID]",
"/subscriptions/[YOUR_SUBSCRIPTIONID2]"
]
}
@Geertvdc
Geertvdc / register-providers.ps1
Last active March 21, 2018 10:49
Register Resource Providers in Azure using Azure CLI
az provider list --query "[].namespace" -o tsv | ForEach-Object { az provider register -n $_}
@Geertvdc
Geertvdc / CreateResourceGroup.cs
Created February 1, 2018 15:45
Create Azure ResourceGroup programmatically
public async Task CreateResourceGroup(string rg, string adgroup)
{
ServicePrincipalLoginInformation loginInfo = new ServicePrincipalLoginInformation()
{
ClientId = System.Environment.GetEnvironmentVariable("ClientId", EnvironmentVariableTarget.Process),
ClientSecret = System.Environment.GetEnvironmentVariable("ClientSecret", EnvironmentVariableTarget.Process)
};
var credentials = new AzureCredentials(loginInfo, System.Environment.GetEnvironmentVariable("TenantId", EnvironmentVariableTarget.Process), AzureEnvironment.AzureGlobalCloud);
@Geertvdc
Geertvdc / StorageEventFunction.cs
Created December 6, 2017 19:41
Event Grid Azure Function
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Host;
using System;
using Newtonsoft.Json;
@Geertvdc
Geertvdc / filecreatedevent.json
Created December 6, 2017 14:31
file created Azure event grid event
[{
"topic": "/subscriptions/4562d10c-8487-4fcf-8bdf-5d9d729f5775/resourceGroups/eventgridtest-rg/providers/Microsoft.Storage/storageAccounts/eventgridtestgeert",
"subject": "/blobServices/default/containers/images/blobs/IMG_0897.jpg",
"eventType": "Microsoft.Storage.BlobCreated",
"eventTime": "2017-12-06T14:18:40.2314711Z",
"id": "84428275-001e-0069-2e9d-6eb6d9065087",
"data": {
"api": "PutBlob",
"clientRequestId": "5a7cbec0-da90-11e7-8359-79266695df26",
"requestId": "84428275-001e-0069-2e9d-6eb6d9000000",
@Geertvdc
Geertvdc / filedeletedevent.json
Created December 6, 2017 14:28
file deleted Azure event grid event
[{
"topic": "/subscriptions/4562d10c-8487-4fcf-8bdf-5d9d729f5775/resourceGroups/eventgridtest-rg/providers/Microsoft.Storage/storageAccounts/eventgridtestgeert",
"subject": "/blobServices/default/containers/images/blobs/IMG_0897.jpg",
"eventType": "Microsoft.Storage.BlobDeleted",
"eventTime": "2017-12-06T14:26:51.9449243Z",
"id": "ac480db3-001e-0049-189e-6ecd7e0695d5",
"data": {
"api": "DeleteBlob",
"clientRequestId": "802486c0-da91-11e7-9e23-c5fcfedfcf18",
"requestId": "ac480db3-001e-0049-189e-6ecd7e000000",
@Geertvdc
Geertvdc / AddApiToAPIManagement.ps1
Last active July 23, 2017 13:22
Add API endpoint to Azure API Management
Param(
[string] $apiManagementRg,
[string] $apiManagementName,
[string] $apiUrl,
[string] $apiDescriptionPath,
[string] $apiName,
[string] $apiId
)
$ApiMgmtContext = New-AzureRmApiManagementContext -ResourceGroupName "$apiManagementRg" -ServiceName "$apiManagementName"