Skip to content

Commit 9186497

Browse files
chore: streamline logging across modules 2 (#352)
Co-authored-by: Pim Simons <32359437+pim-simons@users.noreply.github.com>
1 parent 7a3777a commit 9186497

20 files changed

Lines changed: 87 additions & 109 deletions

File tree

docs/preview/03-Features/powershell/azure-management.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ For more information on API Management and soft deletion see [here](https://docs
3333
**Example**
3434
```powershell
3535
PS> Remove-AzApiManagementSoftDeletedService -Name "my-apim"
36-
# Checking if the API Management instance with name 'my-apim' is listed as a soft deleted service
37-
# API Management instance has been found for name 'my-apim' as a soft deleted service
38-
# Removing the soft deleted API Management instance 'my-apim'
39-
# Successfully removed the soft deleted API Management instance 'my-apim'
36+
# Successfully removed the soft deleted Azure API Management service 'my-apim'
4037
```
4138

4239
## Restoring a soft deleted API Management instance
@@ -59,8 +56,5 @@ For more information on API Management and soft deletion see [here](https://docs
5956
**Example**
6057
```powershell
6158
PS> Restore-AzApiManagementSoftDeletedService -Name "my-apim"
62-
# Checking if the API Management instance with name 'my-apim' is listed as a soft deleted service
63-
# API Management instance has been found for name 'my-apim' as a soft deleted service
64-
# Restoring the soft deleted API Management instance 'my-apim'
65-
# Successfully restored the soft deleted API Management instance 'my-apim'
59+
# Successfully restored the soft deleted API Management service 'my-apim'
6660
```

docs/preview/03-Features/powershell/azure-security.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,5 @@ PS> New-AzResourceGroupRoleAssignment `
103103
-ResourceGroupName "to-assign-role-resource-group" `
104104
-ResourceName "to-assign-resource" `
105105
-RoleAssignmentDefinition "Contributor"
106-
# Assigning Contributor-rights to the 'to-assign-role-resource' in the resource group 'to-assign-resource-group to gain access to the 'to-gain-access-resource-group'
107-
# Contributor access granted!
106+
# Granted Contributor-rights to the 'to-assign-role-resource' in the resource group 'to-assign-resource-group to gain access to the 'to-gain-access-resource-group'!
108107
```

docs/preview/03-Features/powershell/azure-sql.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ PS> Invoke-AzSqlDatabaseMigration `
4444
-DatabaseName "my-database-name" `
4545
-Username "my-sql-username" `
4646
-Password "my-sql-password"
47-
# Looking for SQL scripts in folder: ./sqlScripts
47+
# DB migration 1.0.0 applied!
48+
# Done migrating database. Current Database version is 1.0.0
4849
```
4950

5051
**Example with custom values**
@@ -58,7 +59,8 @@ PS> Invoke-AzSqlDatabaseMigration `
5859
-ScriptsFolder "$PSScriptRoot/sql-scripts" `
5960
-ScriptsFileFilter "*.MyScript.sql" `
6061
-DatabaseSchema "custom"
61-
# Looking for SQL scripts in folder: ./sql-scripts
62+
# DB migration 1.0.0 applied!
63+
# Done migrating database. Current Database version is 1.0.0
6264
```
6365

6466
### Adding SQL scripts so they can be picked up by the script

docs/preview/03-Features/powershell/azure-storage/azure-storage-blob.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ PS> Upload-AzFilesToBlobStorage `
3939
-StorageAccountName "account-name" `
4040
-TargetFolderPath "./directory" `
4141
-ContainerName "blob-container"
42-
# Try using existing Azure Storage Container blob-container...
43-
# Using existing Azure Storage Container blob-container
44-
# Uploading files from ./directory
45-
# Uploaded the file to Azure Blob Storage: [file]
42+
# Uploaded the file [file] to Azure Blob storage container: [Blob URL]
4643
```
4744

4845
With non-existing blob container:
@@ -53,8 +50,5 @@ PS> Upload-AzFilesToBlobStorage `
5350
-StorageAccountName "account-name" `
5451
-TargetFolderPath "./directory" `
5552
-ContainerName "blob-container"
56-
# Try using existing Azure Storage Container blob-container...
57-
# Creating Storage Container blob-container
58-
# Uploading files from ./directory
59-
# Uploaded the file to Azure Blob Storage: [file]
53+
# Uploaded the file [file\ to Azure Blob storage container: [Blob URL]
6054
```

docs/preview/03-Features/powershell/azure-storage/azure-storage-fileshare.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ PS> Create-AzFileShareStorageFolder `
3232
-ResourceGroupName "shipping-resources" `
3333
-StorageAccountName "tracking-account-storage" `
3434
-FileShareName "returned" -FolderName "containers"
35-
# Creating Azure FileShare storage folder 'containers' in file share 'returned'..
3635
# Created Azure FileShare storage folder 'containers' in file share 'returned'
3736
```
3837

@@ -57,8 +56,7 @@ PS> Upload-AzFileShareStorageFiles `
5756
-StorageAccountName "tracking-account-storage" `
5857
-FileShareName "returned" -SourceFolderPath "containers" `
5958
-DestinationFolderName "containers"
60-
# Upload files to Azure FileShare storage 'returned'...
6159
# Uploaded the '[fileName]' file to Azure FileShare 'returned'
6260
# Uploaded the '[fileName]' file to Azure FileShare 'returned'
63-
# Files have been uploaded to Azure FileShare storage 'returned'
61+
# Files have been uploaded to Azure FileShare storage 'returned'
6462
```

docs/preview/03-Features/powershell/azure-storage/azure-storage-table.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ PS> Create-AzStorageTable `
3535
-ResourceGroupName "stock" `
3636
-StorageAccountName "admin" `
3737
-TableName "products"
38-
# Azure storage account context has been retrieved
39-
# Azure storage table 'products' does not exist yet in the Azure storage account, so will create one
40-
# Azure storage table 'products' created
38+
# Azure storage table 'products' does not exist yet in the Azure storage account 'admin', so will create one
39+
# Azure storage table 'products' created in Azure storage account 'admin'
4140
```
4241

4342
With existing table and re-create:
@@ -49,9 +48,8 @@ PS> Create-AzStorageTable `
4948
-TableName "products" `
5049
-Recreate `
5150
-RetryIntervalSeconds 3
52-
# Azure storage account context has been retrieved
53-
# Azure storage table 'products' has been removed
54-
# Failed to re-create the Azure storage table 'products', retrying in 5 seconds...
55-
# Failed to re-create the Azure storage table 'products', retrying in 5 seconds...
56-
# Azure storage table 'products' created
51+
# Azure storage table 'products' has been removed from Azure storage account 'admin'
52+
# Failed to re-create the Azure storage table 'products' in Azure storage account 'admin', retrying in 5 seconds...
53+
# Failed to re-create the Azure storage table 'products' in Azure storage account 'admin', retrying in 5 seconds...
54+
# Azure storage table 'products' created in Azure storage account 'admin'
5755
```

src/Arcus.Scripting.ActiveDirectory/Scripts/Add-AzADAppRoleAssignment.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ try {
5151
$updatedAdServicePrincipal = Get-MgServicePrincipal -ServicePrincipalId $adServicePrincipal.Id
5252

5353
while ($updatedAdServicePrincipal.AppRoles.Value -notcontains $Role -and $counter -lt 10) {
54-
Write-Versbose "Role '$Role' has been added to Active Directory Application '$($adApplication.DisplayName)' but not yet available for use, waiting 10 seconds to retry..."
54+
Write-Verbose "Role '$Role' has been added to Active Directory Application '$($adApplication.DisplayName)' but not yet available for use, waiting 10 seconds to retry..."
5555
Start-Sleep -Seconds 10
5656
$counter++
5757
$updatedAdServicePrincipal = Get-MgServicePrincipal -ServicePrincipalId $adServicePrincipal.Id

src/Arcus.Scripting.Management/Scripts/Get-AzApiManagementResourceManagementUrl.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ param(
33
)
44

55
try {
6-
$resourceManagerUrl = ""
6+
$resourceManagerUrl = ""
77

88
$environments = (Get-AzEnvironment).Name
99
if ($EnvironmentName -notin $environments) {
@@ -28,5 +28,5 @@ try {
2828
catch {
2929
Write-Warning "Failed to retrieve the resource management endpoint"
3030
$ErrorMessage = $_.Exception.Message
31-
Write-Warning "Error: $ErrorMessage"
31+
Write-Debug "Error: $ErrorMessage"
3232
}

src/Arcus.Scripting.Management/Scripts/Get-AzApiManagementSoftDeletedResources.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ param(
66
[Parameter(Mandatory = $true)][string] $ApiVersion
77
)
88

9-
Write-Verbose "Checking if the API Management instance with name '$Name' is listed as a soft deleted service"
9+
Write-Verbose "Checking if the Azure API Management service '$Name' is listed as a soft deleted service..."
1010
$getUri = "$ResourceManagerUrl" + "subscriptions/$SubscriptionId/providers/Microsoft.ApiManagement/deletedservices" + "?api-version=$ApiVersion"
1111

1212
$deletedServices = (Invoke-RestMethod -Method GET -Uri $getUri -Headers $AuthHeader)
1313

1414
if ($deletedServices.value.count -eq 0 -or ($deletedServices.value | Where-Object name -eq $Name).count -eq 0) {
15-
throw "API Management instance with name '$Name' is not listed as a soft deleted service and therefore it cannot be removed or restored"
15+
throw "Azure API Management service '$Name' is not listed as a soft deleted service and therefore it cannot be removed or restored"
1616
}
1717

18-
Write-Host "API Management instance has been found for name '$Name' as a soft deleted service"
18+
Write-Host "Found Azure API Management service '$Name' as a soft deleted service" -ForegroundColor Green
1919

2020
return $deletedServices

src/Arcus.Scripting.Management/Scripts/Remove-AzApiManagementSoftDeletedService.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ $resourceManagerUrl = . $PSScriptRoot\Get-AzApiManagementResourceManagementUrl.p
2222

2323
$deletedServices = . $PSScriptRoot\Get-AzApiManagementSoftDeletedResources.ps1 -Name $Name -SubscriptionId $SubscriptionId -ResourceManagerUrl $resourceManagerUrl -AuthHeader $authHeader -ApiVersion $ApiVersion
2424

25-
Write-Host "Removing the soft deleted API Management instance '$Name'"
25+
Write-Verbose "Removing the soft deleted Azure API Management instance '$Name'..."
2626
try {
2727
$serviceId = ($deletedServices.value | Where-Object name -eq $Name).id
2828
$deleteUri = "$resourceManagerUrl" + "$serviceId" + "?api-version=$ApiVersion"
2929
$removeService = Invoke-RestMethod -Method DELETE -Uri $deleteUri -Headers $authHeader
3030
} catch {
31-
throw "The soft deleted API Management instance '$Name' could not be removed. Details: $($_.Exception.Message)"
31+
throw "Soft deleted Azure API Management service '$Name' could not be removed. Details: $($_.Exception.Message)"
3232
}
3333

34-
Write-Host "Successfully removed the soft deleted API Management instance '$Name'"
34+
Write-Host "Successfully removed the soft deleted Azure API Management service '$Name'" -ForegroundColor Green

0 commit comments

Comments
 (0)