Azure / Azure/azure-powershell

New-AzureRmNotificationHub does not configure Hub programmatically

Open
#6,966 0 comments 1 reaction 0 assignees View on GitHub
customer-reported needs-team-attention Notification Hub Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

New-AzureRmNotificationHub does not configure Hub programmatically via json file. Name and Location properties are used OK, but Hub notification settings specified in Properties section are not set when verified from Azure Portal. When the same setting is set using Azure Portal, it is saved correctly. However Get-AzureRmNotificationHub or Get-AzureRmResource still displays these properties as $null
The same is true with Set-AzureRmNotificationHub when using json file input.
I did not find working example how to implement it via [-NotificationHubObj] so can't tell does it work correctly that way or not. I will appreciate working example creating NotificationHubAttributes object and using it instead of json.

Currently I can't programmatically setup Notification Hubs for my applications in Azure - have to go into each one and configure Notification Settings manually using Azure Portal.

Please take a look into this issue.
Thanks.

### Script/Steps for Reproduction

$rgName = "mkusmiytest-westeu-rg"
$notHubNSName = "mkusmiytest-westeu-001-nhub-ns"
$notHubName = "mkusmiytest-westeu-001-nhub"

$googleApiKey = "SomeValidGoogleApiKey"
$gcmEndpoint = "https://android.googleapis.com/gcm/send"

$resGroup = Get-AzureRmResourceGroup -Name $rgName
New-AzureRmNotificationHubsNamespace -ResourceGroup $rgName -Location $resGroup.Location -Namespace $notHubNSName
$notHubProps = "{""name"":""$notHubName"",""location"": ""$($resGroup.Location)"",""properties"":{""gcmCredential"":{""properties"":{""googleApiKey"":""$googleApiKey"",""gcmEndpoint"":""$gcmEndpoint""}}}}"
$notHubProps | Out-File ".\test.json" -Force
New-AzureRmNotificationHub -ResourceGroup $rgName -Namespace $notHubNSName -InputFile ".\test.json"

### Module Version

6.6.0

### Environment Data

PSVersion 5.1.14393.2363
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.2363
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

### Debug Output

```
Body:
{
"id": "/subscriptions/dab51da4-b7b2-4ca7-998a-fbe5929f8563/resourceGroups/mkusmiytest-westeu-rg/providers/Microsoft.NotificationHubs/namespaces/mkusmiytest-westeu-001-nhub-ns/notificationHubs/mkusmiytest-westeu-001-nhub",
"name": "mkusmiytest-westeu-001-nhub",
"type": "Microsoft.NotificationHubs/namespaces/notificationHubs",
"location": "West Europe",
"tags": null,
"properties": {
"registrationTtl": "10675199.02:48:05.4775807"
}
}

Id : /subscriptions/dab51da4-b7b2-4ca7-998a-fbe5929f8563/resourceGroups/mkusmiytest-westeu-rg/providers/Microsoft.NotificationHubs/namespaces/mkusmiytest-westeu-001-nhub-ns/notificationHubs/mkusmiyte
st-westeu-001-nhub
Type : Microsoft.NotificationHubs/namespaces/notificationHubs
Location : West Europe
Tags :
AdmCredential :
ApnsCredential :
AuthorizationRules :
BaiduCredential :
GcmCredential :
MpnsCredential :
Name : mkusmiytest-westeu-001-nhub
RegistrationTtl : 10675199.02:48:05.4775807
WnsCredential :
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.