Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
233 changes: 116 additions & 117 deletions Authentication/CreateDevAADApp.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ if (-not $applicationName) {
if (-not $workloadName) {
$workloadName = Read-Host "Enter your workload name"
}
while (-not ($workloadName -match "^Org\.[^.]+$"))
{
while (-not ($workloadName -match "^Org\.[^.]+$")) {
$workloadName = Read-Host "Workload name must start with Org. and contain only 2 segments!. please re-enter your workload name"
}
if (-not $tenantId) {
Expand Down Expand Up @@ -74,172 +73,172 @@ $randomString = -join ((65..90) + (97..122) | Get-Random -Count $length | ForEac
$applicationIdUri = "api://localdevinstance/" + $tenantId + "/" + $workloadName + "/" + $randomString

$application = @{
displayName = $applicationName
signInAudience = "AzureADMultipleOrgs"
optionalClaims = @{
displayName = $applicationName
signInAudience = "AzureADMultipleOrgs"
optionalClaims = @{
accessToken = @(
@{
essential = $false
name = "idtyp"
name = "idtyp"
}
)
}
spa = @{
spa = @{
redirectUris = @(
$redirectUri
)
}
identifierUris = @($applicationIdUri)
api = @{
oauth2PermissionScopes = @( # Scopes
identifierUris = @($applicationIdUri)
api = @{
oauth2PermissionScopes = @( # Scopes
@{
adminConsentDisplayName = "FabricWorkloadControl"
adminConsentDescription = "FabricWorkloadControl"
value = "FabricWorkloadControl"
id = $FabricWorkloadControlGuid
isEnabled = $true
type = "User"
value = "FabricWorkloadControl"
id = $FabricWorkloadControlGuid
isEnabled = $true
type = "User"
},
@{
adminConsentDisplayName = "Item1.Read.All"
adminConsentDescription = "Item1.Read.All"
value = "Item1.Read.All"
id = $Item1ReadAllGuid
isEnabled = $true
type = "User"
value = "Item1.Read.All"
id = $Item1ReadAllGuid
isEnabled = $true
type = "User"
},
@{
adminConsentDisplayName = "Item1.ReadWrite.All"
adminConsentDescription = "Item1.ReadWrite.All"
value = "Item1.ReadWrite.All"
id = $Item1ReadWriteAllGuid
isEnabled = $true
type = "User"
value = "Item1.ReadWrite.All"
id = $Item1ReadWriteAllGuid
isEnabled = $true
type = "User"
},
@{
adminConsentDisplayName = "FabricLakehouse.Read.All"
adminConsentDescription = "FabricLakehouse.Read.All"
value = "FabricLakehouse.Read.All"
id = $FabricLakehouseReadAllGuid
isEnabled = $true
type = "User"
value = "FabricLakehouse.Read.All"
id = $FabricLakehouseReadAllGuid
isEnabled = $true
type = "User"
},
@{
adminConsentDisplayName = "FabricLakehouse.ReadWrite.All"
adminConsentDescription = "FabricLakehouse.ReadWrite.All"
value = "FabricLakehouse.ReadWrite.All"
id = $FabricLakehouseReadWriteAllGuid
isEnabled = $true
type = "User"
value = "FabricLakehouse.ReadWrite.All"
id = $FabricLakehouseReadWriteAllGuid
isEnabled = $true
type = "User"
},
@{
adminConsentDisplayName = "KQLDatabase.ReadWrite.All"
adminConsentDescription = "KQLDatabase.ReadWrite.All"
value = "KQLDatabase.ReadWrite.All"
id = $KQLDatabaseReadWriteAllGuid
isEnabled = $true
type = "User"
value = "KQLDatabase.ReadWrite.All"
id = $KQLDatabaseReadWriteAllGuid
isEnabled = $true
type = "User"
},
@{
adminConsentDisplayName = "FabricEventhouse.Read.All"
adminConsentDescription = "FabricEventhouse.Read.All"
value = "FabricEventhouse.Read.All"
id = $FabricEventhouseReadAllGuid
isEnabled = $true
type = "User"
value = "FabricEventhouse.Read.All"
id = $FabricEventhouseReadAllGuid
isEnabled = $true
type = "User"
}
)
preAuthorizedApplications = @( # Preauthorize
@{
appId = "871c010f-5e61-4fb1-83ac-98610a7e9110"
appId = "871c010f-5e61-4fb1-83ac-98610a7e9110"
delegatedPermissionIds = @(
$Item1ReadAllGuid, $Item1ReadWriteAllGuid, $FabricLakehouseReadAllGuid, $FabricLakehouseReadWriteAllGuid, $KQLDatabaseReadWriteAllGuid, $FabricEventhouseReadAllGuid
)
},
@{
appId = "00000009-0000-0000-c000-000000000000"
@{
appId = "00000009-0000-0000-c000-000000000000"
delegatedPermissionIds = @(
$FabricWorkloadControlGuid
)
},
@{
appId = "d2450708-699c-41e3-8077-b0c8341509aa"
appId = "d2450708-699c-41e3-8077-b0c8341509aa"
delegatedPermissionIds = @(
$FabricWorkloadControlGuid
)
}
)
}
requiredResourceAccess = @( # API Permissions
@{
resourceAppId = "e406a681-f3d4-42a8-90b6-c2b029497af1" # Azure Storage
resourceAccess = @(
@{
id = "03e0da56-190b-40ad-a80c-ea378c433f7f" # user_impersonation
type = "Scope"
}
)
},
@{
resourceAppId = "2746ea77-4702-4b45-80ca-3c97e680e8b7" # Azure Data Explorer
resourceAccess = @(
@{
id = "00d678f0-da44-4b12-a6d6-c98bcfd1c5fe" # user_impersonation
type = "Scope"
}
)
},
@{
resourceAppId = "00000003-0000-0000-c000-000000000000" # Graph
resourceAccess = @(
@{
id = "e1fe6dd8-ba31-4d61-89e7-88639da4683d" # User.Read
type = "Scope"
}
)
},
@{
resourceAppId = "00000009-0000-0000-c000-000000000000" # PBI Service
resourceAccess = @(
@{
id = "7ba630b9-8110-4e27-8d17-81e5f2218787" # Fabric.Extend
type = "Scope"
},
@{
id = "b2f1b2fa-f35c-407c-979c-a858a808ba85" # Workspace.Read.All
type = "Scope"
},
@{
id = "caf40b1a-f10e-4da1-86e4-5fda17eb2b07" # Item.Execute.ALL
type = "Scope"
},
@{
id = "d2bc95fc-440e-4b0e-bafd-97182de7aef5" # Item.Read.All
type = "Scope"
},
@{
id = "7a27a256-301d-4359-b77b-c2b759d2e362" # Item.ReadWrite.All
type = "Scope"
},
@{
id = "02e8d710-956c-4760-b996-2e83935c2cf5" # Item.Reshare.All
type = "Scope"
},
@{
id = "13060bfd-9305-4ec6-8388-8916580f4fa9" # Lakehouse.Read.All
type = "Scope"
},
@{
id = "cd1718e4-3e09-4381-a6e1-183e245f8613" # Eventhouse.Read.All
type = "Scope"
},
@{
id = "726667b1-01a6-4be4-b04c-e95eae4023a8" # KQLDatabase.ReadWrite.All
type = "Scope"
}
)
}
)
requiredResourceAccess = @( # API Permissions
@{
resourceAppId = "e406a681-f3d4-42a8-90b6-c2b029497af1" # Azure Storage
resourceAccess = @(
@{
id = "03e0da56-190b-40ad-a80c-ea378c433f7f" # user_impersonation
type = "Scope"
}
)
},
@{
resourceAppId = "2746ea77-4702-4b45-80ca-3c97e680e8b7" # Azure Data Explorer
resourceAccess = @(
@{
id = "00d678f0-da44-4b12-a6d6-c98bcfd1c5fe" # user_impersonation
type = "Scope"
}
)
},
@{
resourceAppId = "00000003-0000-0000-c000-000000000000" # Graph
resourceAccess = @(
@{
id = "e1fe6dd8-ba31-4d61-89e7-88639da4683d" # User.Read
type = "Scope"
}
)
},
@{
resourceAppId = "00000009-0000-0000-c000-000000000000" # PBI Service
resourceAccess = @(
@{
id = "7ba630b9-8110-4e27-8d17-81e5f2218787" # Fabric.Extend
type = "Scope"
},
@{
id = "b2f1b2fa-f35c-407c-979c-a858a808ba85" # Workspace.Read.All
type = "Scope"
},
@{
id = "caf40b1a-f10e-4da1-86e4-5fda17eb2b07" # Item.Execute.ALL
type = "Scope"
},
@{
id = "d2bc95fc-440e-4b0e-bafd-97182de7aef5" # Item.Read.All
type = "Scope"
},
@{
id = "7a27a256-301d-4359-b77b-c2b759d2e362" # Item.ReadWrite.All
type = "Scope"
},
@{
id = "02e8d710-956c-4760-b996-2e83935c2cf5" # Item.Reshare.All
type = "Scope"
},
@{
id = "13060bfd-9305-4ec6-8388-8916580f4fa9" # Lakehouse.Read.All
type = "Scope"
},
@{
id = "cd1718e4-3e09-4381-a6e1-183e245f8613" # Eventhouse.Read.All
type = "Scope"
},
@{
id = "726667b1-01a6-4be4-b04c-e95eae4023a8" # KQLDatabase.ReadWrite.All
type = "Scope"
}
)
}
)
}

# Convert to valid json format (escape the '"')
Expand Down Expand Up @@ -268,11 +267,11 @@ $startUtcDateTimeString = $startUtcDateTimeString.ToString('u') -replace ' ', 'T
$endUtcDateTimeString = $endUtcDateTimeString.ToString('u') -replace ' ', 'T'

$passwordCreds = @{
passwordCredential = @{
displayName = "SampleSecret"
endDateTime = $endUtcDateTimeString
startDateTime = $startUtcDateTimeString
}
passwordCredential = @{
displayName = "SampleSecret"
endDateTime = $endUtcDateTimeString
startDateTime = $startUtcDateTimeString
}
}

# Convert to valid json format (escape the '"')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ public static class EnvironmentConstants

public const string FabricApiBaseUrl = "https://api.fabric.microsoft.com";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ public interface IEndpointResolutionController
/// <br/>
/// <br/>To resolve an endpoint, Fabric will send a POST request with the required context properties in the request body. The response will contain the resolved URL and its TTL, which indicates how long the URL is considered valid.
/// <br/>
/// <br/>For a sample implementation and usage examples, please refer to the [Endpoint Resolution Sample Code](https://github.com/microsoft/Microsoft-Fabric-workload-development-sample/blob/main/Backend/src/Controllers/EndpointResolutionControllerImpl.cs).
/// <br/>For a sample implementation and usage examples, please refer to the [Endpoint Resolution Sample Code](https://github.com/microsoft/Microsoft-Fabric-workload-development-sample/blob/main/Backend/dotnet/src/Controllers/EndpointResolutionControllerImpl.cs).
/// </remarks>

/// <param name="body">Endpoint resolution request payload</param>
Expand Down Expand Up @@ -464,7 +464,7 @@ public EndpointResolutionController(IEndpointResolutionController implementation
/// <br/>
/// <br/>To resolve an endpoint, Fabric will send a POST request with the required context properties in the request body. The response will contain the resolved URL and its TTL, which indicates how long the URL is considered valid.
/// <br/>
/// <br/>For a sample implementation and usage examples, please refer to the [Endpoint Resolution Sample Code](https://github.com/microsoft/Microsoft-Fabric-workload-development-sample/blob/main/Backend/src/Controllers/EndpointResolutionControllerImpl.cs).
/// <br/>For a sample implementation and usage examples, please refer to the [Endpoint Resolution Sample Code](https://github.com/microsoft/Microsoft-Fabric-workload-development-sample/blob/main/Backend/dotnet/src/Controllers/EndpointResolutionControllerImpl.cs).
/// </remarks>
/// <param name="body">Endpoint resolution request payload</param>
/// <returns>Endpoint resolution response</returns>
Expand Down Expand Up @@ -912,10 +912,10 @@ public partial class EndpointResolutionResponse

}

#pragma warning restore 108
#pragma warning restore 114
#pragma warning restore 472
#pragma warning restore 612
#pragma warning restore 108
#pragma warning restore 114
#pragma warning restore 472
#pragma warning restore 612
#pragma warning restore 1573
#pragma warning restore 1591
#pragma warning restore 8073
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@
"/resolve-api-path-placeholder": {
"post": {
"summary": "Resolve an endpoint for a given service called by Microsoft Fabric",
"description": "Resolves the endpoint for a given service called by Microsoft Fabric based on the tenant's region and workspace region. Fabric provides a set of context properties and returns the appropriate service endpoint URL and its time-to-live (TTL).\n\nThe Endpoint Resolution API is crucial for services that require dynamic endpoint determination based on operational context. This allows for optimized routing and regional compliance.\n\nTo resolve an endpoint, Fabric will send a POST request with the required context properties in the request body. The response will contain the resolved URL and its TTL, which indicates how long the URL is considered valid.\n\nFor a sample implementation and usage examples, please refer to the [Endpoint Resolution Sample Code](https://github.com/microsoft/Microsoft-Fabric-workload-development-sample/blob/main/Backend/src/Controllers/EndpointResolutionControllerImpl.cs).",
"description": "Resolves the endpoint for a given service called by Microsoft Fabric based on the tenant's region and workspace region. Fabric provides a set of context properties and returns the appropriate service endpoint URL and its time-to-live (TTL).\n\nThe Endpoint Resolution API is crucial for services that require dynamic endpoint determination based on operational context. This allows for optimized routing and regional compliance.\n\nTo resolve an endpoint, Fabric will send a POST request with the required context properties in the request body. The response will contain the resolved URL and its TTL, which indicates how long the URL is considered valid.\n\nFor a sample implementation and usage examples, please refer to the [Endpoint Resolution Sample Code](https://github.com/microsoft/Microsoft-Fabric-workload-development-sample/blob/main/Backend/dotnet/src/Controllers/EndpointResolutionControllerImpl.cs).",
"operationId": "EndpointResolution_Resolve",
"tags": [ "EndpointResolution" ],
"consumes": [ "application/json" ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace Boilerplate.Controllers
public class EventhouseController : ControllerBase
{
private static readonly IList<string> EventhubFabricScopes = new[] { $"{EnvironmentConstants.FabricBackendResourceId}/Eventhouse.Read.All" };

private readonly ILogger<EventhouseController> _logger;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IAuthenticationService _authenticationService;
Expand Down Expand Up @@ -46,6 +47,7 @@ IHttpClientService httpClientService
public async Task<IActionResult> GetEventhouse(Guid workspaceId, Guid eventhouseId)
{
_logger.LogInformation("GetEventhouse: get eventhouse '{0}' in workspace '{1}'", eventhouseId, workspaceId);

var authorizationContext = await _authenticationService.AuthenticateDataPlaneCall(_httpContextAccessor.HttpContext, allowedScopes: new string[] {WorkloadScopes.FabricEventhouseReadAll});
var token = await _authenticationService.GetAccessTokenOnBehalfOf(authorizationContext, EventhubFabricScopes);

Expand All @@ -59,6 +61,7 @@ public async Task<IActionResult> GetEventhouse(Guid workspaceId, Guid eventhouse
}
var eventhouse = await response.Content.ReadAsAsync<EventhouseItem>();
return Ok(eventhouse);

}
}
}
Loading