I'm using powershell to add gallery item to my local AzureStack (script below), however I ran into an error for "resource namespace 'microsoft.gallery.admin' is invalid. This I think means that the microsoft.gallery.admin resource is not available in my subscription.
I've went into my admin accounts subscriptions (Consumption Subscription, Default Provider Subscription, and Metering Subscription) and registered everything for gallery, but it still doesnt work. So my question is how can I enable microsoft.gallery.item resource.
My second question is to do with accounts in Azurestack and Azure. Right now I use the same account for my Azure cloud, Azurestack admin, and azurestack user. ie name@azuretenantname.onmicrosoft.com.
Is there an azurestacklocal account that is generated automatically or something that I can use to admin local? Or is this method fine.
Thanks in advance for any help!
$AADTenantName = "azurestoreomitted.onmicrosoft.com" $ArmEndpoint = "https://management.local.azurestack.external" # Register an Azure Resource Manager environment that targets your Azure Stack instance Add-AzureRMEnvironment ` -Name "AzureStackUser" ` -ArmEndpoint $ArmEndpoint $AuthEndpoint = (Get-AzureRmEnvironment -Name "AzureStackUser").ActiveDirectoryAuthority.TrimEnd('/') $TenantId = (invoke-restmethod "$($AuthEndpoint)/$($AADTenantName)/.well-known/openid-configuration").issuer.TrimEnd('/').Split('/')[-1] # Sign in to your environment Login-AzureRmAccount ` -EnvironmentName "AzureStackUser" ` -TenantId $TenantId Add-AzsGalleryItem -GalleryItemUri ` https://thomasazsblob.blob.local.azurestack.external/general/omitted.azpkg –Verbose #$subscriptionid = (Get-AzureRmSubscription -SubscriptionName 'ThomasSubscription').SubscriptionId #$StorageAccount = Get-AzureRmStorageAccount -ResourceGroupName thomasazslocal -Name thomasazsblob #$GalleryContainer = New-AzureStorageContainer -Name gallery -Permission Blob -Context $StorageAccount.Context #$azpkg = $GalleryContainer | Set-AzureStorageBlobContent -File C:\omitted\omitted.azpkg #Add-AzureRMGalleryItem -SubscriptionId $subscriptionid -GalleryItemUri $azpkg.ICloudBlob.StorageUri.PrimaryUri.AbsoluteUri -Apiversion "2015-04-01"
OUTPUT
PS C:\Windows\system32> C:\Users\AzureStackAdmin\Desktop\Untitled1.ps1 Name : AzureStackUser EnableAdfsAuthentication : False OnPremise : False ActiveDirectoryServiceEndpointResourceId : https://management.azurestoreomitted.onmicrosoft.com/##resourceguidomitted## AdTenant : GalleryUrl : https://portal.local.azurestack.external:30015/ ManagementPortalUrl : ServiceManagementUrl : PublishSettingsFileUrl : ResourceManagerUrl : https://management.local.azurestack.external SqlDatabaseDnsSuffix : StorageEndpointSuffix : local.azurestack.external ActiveDirectoryAuthority : https://login.windows.net/ GraphUrl : https://graph.windows.net/ GraphEndpointResourceId : https://graph.windows.net/ TrafficManagerDnsSuffix : AzureKeyVaultDnsSuffix : vault.local.azurestack.external DataLakeEndpointResourceId : AzureDataLakeStoreFileSystemEndpointSuffix : AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix : AzureKeyVaultServiceEndpointResourceId : https://vault.local.azurestack.external AzureOperationalInsightsEndpointResourceId : AzureOperationalInsightsEndpoint : VersionProfiles : {} ExtendedProperties : {} BatchEndpointResourceId : Environments : {[AzureStackUser, AzureStackUser], [AzureChinaCloud, AzureChinaCloud], [Azure Stack, Azure Stack], [AzureCloud, AzureCloud]...} Context : Microsoft.Azure.Commands.Profile.Models.PSAzureContext VERBOSE: Performing the operation "Add Gallery item" on target "https://thomasazsblob.blob.local.azurestack.external/general/omitted.azpkg". VERBOSE: Performing operation add on $GalleryAdminClient. VERBOSE: Operation failed. Get-Exception : Code = InvalidResourceNamespace Message = The resource namespace 'microsoft.gallery.admin' is invalid. At C:\Program Files\WindowsPowerShell\Modules\Azs.Gallery.Admin\0.2.0\Get-TaskResult.ps1:99 char:21+ Get-Exception -Exception $ex+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : NotSpecified: (:) [Write-Error], Exception+ FullyQualifiedErrorId : System.Exception,Get-Exception