Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Insights] Need example of properly formed WorkspaceId #4465

Closed
markcowl opened this issue Aug 11, 2017 · 3 comments
Closed

[Insights] Need example of properly formed WorkspaceId #4465

markcowl opened this issue Aug 11, 2017 · 3 comments
Assignees
Labels
Monitor Service Attention This issue is responsible by Azure service team.

Comments

@markcowl
Copy link
Member

From the gallery: https://www.powershellgallery.com/packages/AzureRM.Insights/3.2.1

I'm trying to use Set-AzureRmDiagnosticSetting  with the workspaceid parameter (which I got from the gui and is of the form "185*****-e8c2-49*7-d0ab410" but I get the error: 

Property id '************************************'' at path 'properties.workspaceId' is invalid. Expect fully 
qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.

But I'm not sure where the relevant name space it here?

Please respond to the issue, and please add an example in the markdown file to show a properly formed WorkspaceId

@markcowl markcowl changed the title [Insights] Need example of poperly formed WorkspaceId [Insights] Need example of properly formed WorkspaceId Aug 11, 2017
@MMollyy
Copy link

MMollyy commented Aug 14, 2017

Hi Mark,

A friend of mine tested a part of my script:
keyvault, disk encryption, audit logging

Section # 4.
I can't run it myself, as my PS is having issues. But he tested it on an existing key vault, and with an existing workspace. He said the script finished just fine, and I can confirm from the portal.

the test script I had him run was:

<# Parameter section
    Do not forget that all mandatory parameters need to be given input before the start of the script
    eg: .\KeyVaultandDiskEncryption.ps1 -resourcegroupname XXX -keyvaultName XXX etc
#>
Param(
  [Parameter(Mandatory = $true, 
             HelpMessage="Name of the resource group to which the KeyVault belongs to.  A new resource group with this name will be created if one doesn't exist")]
  [ValidateNotNullOrEmpty()]
  [string]$resourceGroupName,

  [Parameter(Mandatory = $true,
             HelpMessage="Name of the KeyVault in which encryption keys are to be placed. A new vault with this name will be created if one doesn't exist")]
  [ValidateNotNullOrEmpty()]
  [string]$keyVaultName,

  [Parameter(Mandatory = $true,
             HelpMessage="Location of the KeyVault. Important note: Make sure the KeyVault and VMs to be encrypted are in the same region / location.")]
  [ValidateNotNullOrEmpty()]
  [string]$location,

  [Parameter(Mandatory = $true,
             HelpMessage="Name of the AAD application that will be used to write secrets to KeyVault. A new application with this name will be created if one doesn't exist. If this app already exists, pass aadClientSecret parameter to the script")]
  [ValidateNotNullOrEmpty()]
  [string]$aadAppName,

  [Parameter(Mandatory = $false,
             HelpMessage="Client secret of the AAD application that was created earlier")]
  [ValidateNotNullOrEmpty()]
  [string]$aadClientSecret,

  [Parameter(Mandatory = $true,
             HelpMessage="Identifier of the Azure subscription to be used. Default subscription will be used if not specified.")]
  [ValidateNotNullOrEmpty()]
  [string]$subscriptionId,

  [Parameter(Mandatory = $false,
             HelpMessage="Name of optional key encryption key in KeyVault. A new key with this name will be created if one doesn't exist")]
  [ValidateNotNullOrEmpty()]
  [string]$keyEncryptionKeyName
)

########################################################################################################################
# Section1:  Log-in to Azure and select appropriate subscription. 
########################################################################################################################
Write-Host 'Please log into Azure now' -foregroundcolor Green;
Login-AzureRmAccount -ErrorAction "Stop" 1> $null;

if($subscriptionId)
    {
        Select-AzureRmSubscription -SubscriptionId $subscriptionId;
    }

########################################################################################################################
# Section 4:  Key vault Auditing to Operational Insights
########################################################################################################################
$kv = Get-AzureRmKeyVault -VaultName $keyVaultName
$workspace = Get-AzureRmOperationalInsightsWorkspace -ResourceGroupName $resourceGroupName -Name $kv.name
Set-AzureRmDiagnosticSetting -ResourceId $kv.ResourceId -workspaceid $workspace.ResourceId -Enabled $true

Hope this is of some help to you.

@maddieclayton
Copy link
Contributor

@gucalder Looks like the help was never updated to reflect this customer question. Can you please take a look?

@bsiegel bsiegel added the Service Attention This issue is responsible by Azure service team. label Sep 26, 2018
@muralijv
Copy link

Hi
I am running on AzureRM.Insights 5.1.5 still getting the following error :

Command :
Set-AzureRmDiagnosticSetting -Name $diagsettingname -ResourceId $sqlServerResourceId
-WorkspaceId $WSID -Enabled $True -RetentionEnabled $True -RetentionInDays 30

Error Message :
Exception type: ErrorResponseException, Message: The diagnostic setting 'devUksSQLDBauth55diagsetting' doesn't exist., Code: ResourceNotFound, Status code:NotFound, Reason phrase: Not Found

Any possible solution or fixes - your help is much appreacited

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Monitor Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

7 participants