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

Set-AzureRmResource gives input object cannot be bound error #8240

Closed
yxie97 opened this issue Jan 5, 2019 · 21 comments
Closed

Set-AzureRmResource gives input object cannot be bound error #8240

yxie97 opened this issue Jan 5, 2019 · 21 comments
Assignees
Milestone

Comments

@yxie97
Copy link

yxie97 commented Jan 5, 2019

Description

Started to have a weird issue after installing AzureRm 6.13.1. Even simplest code (get a resource and set it back) as below:

$WebAppConfig = (Get-AzureRmResource -ResourceType Microsoft.Web/sites/config -ResourceName $API.name -ResourceGroupName $CSResourceGroupName -ApiVersion $APIVersion)
$WebAppConfig | Set-AzureRmResource -ApiVersion $APIVersion -Force | Out-Null

throws an excpetion:

Set-AzureRmResource : The input object cannot be bound because it did not contain the information required to bind all mandatory parameters: InputObject
At line:12 char:25
+ ... AppConfig | Set-AzureRmResource -ApiVersion $APIVersion -Force | Out- ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (@{Name=createno...e; Properties=}:PSObject) [Set-AzureRmResource], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectMissingMandatory,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.SetAzureResourceCmdlet

Now even after I uninstalled 6.13.1, I am still getting this issue

Script/Steps for Reproduction

Module Version

Get-Module -ListAvailable

Environment Data

$PSVersionTable

Debug Output


@cormacpayne
Copy link
Member

@yxie97 I'm unable to reproduce this exception with other resource types. Would you mind doing the following:

(1) Uninstall all instances of AzureRM on your machine and install the new Az module. More information here.
(2) If you're still seeing this error with the Az module, set $DebugPreference = "Continue", re-run the command, and send us the resulting debug stream. Also, sending the result of Resolve-AzError after the command has thrown an exception will help to get the full error details as well.
(3) Confirm whether or not this exception occurs for all resource types that you try, or specific ones.

@maddieclayton
Copy link
Contributor

@yxie97 Ping

@maddieclayton maddieclayton modified the milestones: 2019-02-12, 2019-02-26 Feb 9, 2019
@praharshp
Copy link

praharshp commented Feb 11, 2019

Hi @maddieclayton , I am also facing same issue with Set-AzureRmResource command. Few of my scripts were working fine since last year and now since January they have started reporting error.

$ApiVersion = "2016-08-01" $WebAppResourceType = 'Microsoft.Web/sites/config' $WebAppPropertiesObject = @{ "virtualApplications" = @( @{ "virtualPath" = "/"; "physicalPath" = "site\wwwroot"; }, @{ "virtualPath" = "/abc"; "physicalPath" = "site\wwwroot\abc"; } ) } $webAppResource = Get-AzureRmResource -ApiVersion $ApiVersion -ResourceType $WebAppResourceType -ResourceGroupName $ResourceGroupName -ResourceName $WebAppName $webAppResource | Set-AzureRmResource -ApiVersion $ApiVersion -PropertyObject $WebAppPropertiesObject -Force
AzureRm version : 6.8.1
PS Version : 5.1

It fails with below error:

Set-AzureRmResource : The input object cannot be bound because it did not contain the information required to bind all mandatory parameters:  InputObject
At line:1 char:19
+ ... pResource | Set-AzureRmResource -ApiVersion $ApiVersion -Properties $ ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (@{Name=900004we...e; Properties=}:PSObject) [Set-AzureRmResource], ParameterBindingException
    + FullyQualifiedErrorId : InputObjectMissingMandatory,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.SetAzureResourceCmdlet

Can you please check and suggest what could be the issue here.

@maddieclayton
Copy link
Contributor

@praharshp Can you provide the information that Cormac requested above?

"
I'm unable to reproduce this exception with other resource types. Would you mind doing the following:

(1) Uninstall all instances of AzureRM on your machine and install the new Az module. More information here.
(2) If you're still seeing this error with the Az module, set $DebugPreference = "Continue", re-run the command, and send us the resulting debug stream. Also, sending the result of Resolve-AzError after the command has thrown an exception will help to get the full error details as well.
(3) Confirm whether or not this exception occurs for all resource types that you try, or specific ones.
"

@praharshp
Copy link

@maddieclayton thanks for replying. Unfortunately I cannot try that. The servers where the issue is observed are customer production environments and many other scripts are running on them without any issues.

Can you suggest similar steps to capture debugging logs on AzureRm that might help in your investigation.

@TomaszOledzki
Copy link

Same issue here. Checked on few PCs. Including a fresh installation of Windows 10 and PowerShellModules.

Just a few commands (as described on Set-AzureRmResource docs: https://docs.microsoft.com/en-us/powershell/module/azurerm.resources/set-azurermresource?view=azurermps-6.13.0)

$ResourceType = Microsoft.Web/sites/config
$ResourceName = tolapp
$ResourceGroupName = tolapp

$WebAppConfig = (Get-AzureRmResource -ResourceType $ResourceType -ResourceName $ResourceName -ResourceGroupName $ResourceGroupName -ApiVersion 2018-11-01)
$WebAppConfig.Properties.alwaysOn = $true
$WebAppConfig | Set-AzureRmResource -Force -ApiVersion 2018-11-01

Throws:

DEBUG: 17:08:38 - SetAzureResourceCmdlet begin processing with ParameterSet 'ByInputObject'.
DEBUG: 17:08:38 - using account id 'someuser@somedomain'...
Set-AzureRmResource : The input object cannot be bound because it did not contain the information required to bind all mandatory parameters
:  InputObject
At line:1 char:6
+ $WebAppConfig | Set-AzureRmResource -Force -ApiVersion 2018-11-01
+      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (@{Name=tolapp; ...d; Properties=}:PSObject) [Set-AzureRmResource], ParameterBindingExcepti
   on
    + FullyQualifiedErrorId : InputObjectMissingMandatory,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.SetAzureResource
   Cmdlet

DEBUG: AzureQoSEvent: CommandName - Set-AzureRmResource; IsSuccess - True; Duration - 00:00:00.2090779; Exception - ;
DEBUG: Finish sending metric.
DEBUG: 17:08:39 - SetAzureResourceCmdlet end processing.
DEBUG: 17:08:39 - SetAzureResourceCmdlet end processing.
$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.16299.820
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.820
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
Get-Module -ListAvailable

ModuleType Version    Name                                ExportedCommands                                                                 
---------- -------    ----                                ----------------                                                                 
Script     0.5.4      Azure.AnalysisServices              {Add-AzureAnalysisServicesAccount, Restart-AzureAnalysisServicesInstance, Expo...
Script     4.6.1      Azure.Storage                       {Get-AzureStorageTable, New-AzureStorageTableSASToken, New-AzureStorageTableSt...
Binary     2.0.2.4    AzureAD                             {Add-AzureADApplicationOwner, Get-AzureADApplication, Get-AzureADApplicationEx...
Script     6.13.1     AzureRM                                                                                                              
Script     0.6.14     AzureRM.AnalysisServices            {Resume-AzureRmAnalysisServicesServer, Suspend-AzureRmAnalysisServicesServer, ...
Script     6.1.7      AzureRM.ApiManagement               {Add-AzureRmApiManagementRegion, Get-AzureRmApiManagementSsoToken, New-AzureRm...
Script     6.1.5      AzureRM.ApiManagement               {Add-AzureRmApiManagementRegion, Get-AzureRmApiManagementSsoToken, New-AzureRm...
Script     0.1.8      AzureRM.ApplicationInsights         {Get-AzureRmApplicationInsights, New-AzureRmApplicationInsights, Remove-AzureR...
Script     6.1.1      AzureRM.Automation                  {Get-AzureRMAutomationHybridWorkerGroup, Remove-AzureRmAutomationHybridWorkerG...
Script     5.1.2      AzureRM.Automation                  {Get-AzureRMAutomationHybridWorkerGroup, Get-AzureRmAutomationJobOutputRecord,...
Script     4.0.11     AzureRM.Backup                      {Backup-AzureRmBackupItem, Enable-AzureRmBackupContainerReregistration, Get-Az...
Script     4.1.5      AzureRM.Batch                       {Remove-AzureRmBatchAccount, Get-AzureRmBatchAccount, Get-AzureRmBatchAccountK...
Script     0.14.6     AzureRM.Billing                     {Get-AzureRmBillingInvoice, Get-AzureRmBillingPeriod, Get-AzureRmEnrollmentAcc...
Script     5.0.6      AzureRM.Cdn                         {Get-AzureRmCdnProfile, Get-AzureRmCdnProfileSsoUrl, New-AzureRmCdnProfile, Re...
Script     0.9.12     AzureRM.CognitiveServices           {Get-AzureRmCognitiveServicesAccount, Get-AzureRmCognitiveServicesAccountKey, ...
Script     5.9.1      AzureRM.Compute                     {Remove-AzureRmAvailabilitySet, Get-AzureRmAvailabilitySet, New-AzureRmAvailab...
Script     5.8.0      AzureRM.Compute                     {Remove-AzureRmAvailabilitySet, Get-AzureRmAvailabilitySet, New-AzureRmAvailab...
Script     0.3.7      AzureRM.Consumption                 {Get-AzureRmConsumptionBudget, Get-AzureRmConsumptionMarketplace, Get-AzureRmC...
Script     0.2.12     AzureRM.ContainerInstance           {New-AzureRmContainerGroup, Get-AzureRmContainerGroup, Remove-AzureRmContainer...
Script     0.2.10     AzureRM.ContainerInstance           {New-AzureRmContainerGroup, Get-AzureRmContainerGroup, Remove-AzureRmContainer...
Script     1.0.10     AzureRM.ContainerRegistry           {New-AzureRmContainerRegistry, Get-AzureRmContainerRegistry, Update-AzureRmCon...
Script     5.0.3      AzureRM.DataFactories               {Remove-AzureRmDataFactory, Get-AzureRmDataFactoryRun, Get-AzureRmDataFactoryS...
Script     0.5.11     AzureRM.DataFactoryV2               {Set-AzureRmDataFactoryV2, Update-AzureRmDataFactoryV2, Get-AzureRmDataFactory...
Script     5.1.4      AzureRM.DataLakeAnalytics           {Get-AzureRmDataLakeAnalyticsDataSource, New-AzureRmDataLakeAnalyticsCatalogCr...
Script     6.2.1      AzureRM.DataLakeStore               {Get-AzureRmDataLakeStoreTrustedIdProvider, Remove-AzureRmDataLakeStoreTrusted...
Script     4.0.9      AzureRM.DevTestLabs                 {Get-AzureRmDtlAllowedVMSizesPolicy, Get-AzureRmDtlAutoShutdownPolicy, Get-Azu...
Script     5.1.0      AzureRM.Dns                         {Get-AzureRmDnsRecordSet, New-AzureRmDnsRecordConfig, Remove-AzureRmDnsRecordS...
Script     0.3.7      AzureRM.EventGrid                   {New-AzureRmEventGridTopic, Get-AzureRmEventGridTopic, Set-AzureRmEventGridTop...
Script     0.7.0      AzureRM.EventHub                    {New-AzureRmEventHubNamespace, Get-AzureRmEventHubNamespace, Set-AzureRmEventH...
Script     4.1.8      AzureRM.HDInsight                   {Get-AzureRmHDInsightJob, New-AzureRmHDInsightSqoopJobDefinition, Wait-AzureRm...
Script     5.1.5      AzureRM.Insights                    {Get-AzureRmMetricDefinition, Get-AzureRmMetric, Remove-AzureRmLogProfile, Get...
Script     3.1.8      AzureRM.IotHub                      {Add-AzureRmIotHubKey, Get-AzureRmIotHubEventHubConsumerGroup, Get-AzureRmIotH...
Script     5.2.1      AzureRM.KeyVault                    {Add-AzureKeyVaultCertificate, Update-AzureKeyVaultCertificate, Stop-AzureKeyV...
Script     4.1.4      AzureRM.LogicApp                    {Get-AzureRmIntegrationAccountAgreement, Get-AzureRmIntegrationAccountCallback...
Script     0.18.5     AzureRM.MachineLearning             {Move-AzureRmMlCommitmentAssociation, Get-AzureRmMlCommitmentAssociation, Get-...
Script     0.4.8      AzureRM.MachineLearningCompute      {Get-AzureRmMlOpCluster, Get-AzureRmMlOpClusterKey, Test-AzureRmMlOpClusterSys...
Script     0.2.7      AzureRM.MarketplaceOrdering         {Get-AzureRmMarketplaceTerms, Set-AzureRmMarketplaceTerms}                       
Script     0.2.5      AzureRM.MarketplaceOrdering         {Get-AzureRmMarketplaceTerms, Set-AzureRmMarketplaceTerms}                       
Script     0.10.4     AzureRM.Media                       {Sync-AzureRmMediaServiceStorageKeys, Set-AzureRmMediaServiceKey, Get-AzureRmM...
Script     6.11.1     AzureRM.Network                     {Add-AzureRmApplicationGatewayAuthenticationCertificate, Get-AzureRmApplicatio...
Script     6.10.0     AzureRM.Network                     {Add-AzureRmApplicationGatewayAuthenticationCertificate, Get-AzureRmApplicatio...
Script     5.0.3      AzureRM.NotificationHubs            {Get-AzureRmNotificationHub, Get-AzureRmNotificationHubAuthorizationRules, Get...
Script     5.0.6      AzureRM.OperationalInsights         {New-AzureRmOperationalInsightsAzureActivityLogDataSource, New-AzureRmOperatio...
Script     1.1.0      AzureRM.PolicyInsights              {Get-AzureRmPolicyEvent, Get-AzureRmPolicyState, Get-AzureRmPolicyStateSummary...
Script     4.1.10     AzureRM.PowerBIEmbedded             {Remove-AzureRmPowerBIWorkspaceCollection, Get-AzureRmPowerBIWorkspaceCollecti...
Script     5.8.2      AzureRM.profile                     {Disable-AzureRmDataCollection, Disable-AzureRmContextAutosave, Enable-AzureRm...
Script     5.8.0      AzureRM.profile                     {Disable-AzureRmDataCollection, Disable-AzureRmContextAutosave, Enable-AzureRm...
Script     4.1.9      AzureRM.RecoveryServices            {Get-AzureRmRecoveryServicesBackupProperty, Get-AzureRmRecoveryServicesVault, ...
Script     4.1.8      AzureRM.RecoveryServices            {Get-AzureRmRecoveryServicesBackupProperty, Get-AzureRmRecoveryServicesVault, ...
Script     4.5.2      AzureRM.RecoveryServices.Backup     {Backup-AzureRmRecoveryServicesBackupItem, Get-AzureRmRecoveryServicesBackupMa...
Script     4.5.0      AzureRM.RecoveryServices.Backup     {Backup-AzureRmRecoveryServicesBackupItem, Get-AzureRmRecoveryServicesBackupMa...
Script     0.2.12     AzureRM.RecoveryServices.SiteRec... {Edit-AzureRmRecoveryServicesAsrRecoveryPlan, Get-AzureRmRecoveryServicesAsrAl...
Script     0.2.10     AzureRM.RecoveryServices.SiteRec... {Edit-AzureRmRecoveryServicesAsrRecoveryPlan, Get-AzureRmRecoveryServicesAsrAl...
Script     5.1.0      AzureRM.RedisCache                  {Remove-AzureRmRedisCachePatchSchedule, New-AzureRmRedisCacheScheduleEntry, Ge...
Script     0.3.12     AzureRM.Relay                       {New-AzureRmRelayNamespace, Get-AzureRmRelayNamespace, Set-AzureRmRelayNamespa...
Script     0.3.10     AzureRM.Relay                       {New-AzureRmRelayNamespace, Get-AzureRmRelayNamespace, Set-AzureRmRelayNamespa...
Script     6.7.3      AzureRM.Resources                   {Get-AzureRmProviderOperation, Remove-AzureRmRoleAssignment, Get-AzureRmRoleAs...
Script     6.7.1      AzureRM.Resources                   {Get-AzureRmProviderOperation, Remove-AzureRmRoleAssignment, Get-AzureRmRoleAs...
Script     0.16.10    AzureRM.Scheduler                   {Disable-AzureRmSchedulerJobCollection, Enable-AzureRmSchedulerJobCollection, ...
Script     0.6.13     AzureRM.ServiceBus                  {New-AzureRmServiceBusNamespace, Get-AzureRmServiceBusNamespace, Set-AzureRmSe...
Script     0.3.15     AzureRM.ServiceFabric               {Add-AzureRmServiceFabricApplicationCertificate, Add-AzureRmServiceFabricClien...
Script     0.3.13     AzureRM.ServiceFabric               {Add-AzureRmServiceFabricApplicationCertificate, Add-AzureRmServiceFabricClien...
Script     1.0.0      AzureRM.SignalR                     {New-AzureRmSignalR, Get-AzureRmSignalR, Get-AzureRmSignalRKey, New-AzureRmSig...
Script     4.12.1     AzureRM.Sql                         {Get-AzureRmSqlDatabaseTransparentDataEncryption, Get-AzureRmSqlDatabaseTransp...
Script     4.11.5     AzureRM.Sql                         {Get-AzureRmSqlDatabaseTransparentDataEncryption, Get-AzureRmSqlDatabaseTransp...
Script     5.2.0      AzureRM.Storage                     {Get-AzureRmStorageAccount, Get-AzureRmStorageAccountKey, New-AzureRmStorageAc...
Script     4.0.10     AzureRM.StreamAnalytics             {Get-AzureRmStreamAnalyticsFunction, Get-AzureRmStreamAnalyticsDefaultFunction...
Script     4.0.5      AzureRM.Tags                        {Remove-AzureRmTag, Get-AzureRmTag, New-AzureRmTag}                              
Script     4.1.3      AzureRM.TrafficManager              {Add-AzureRmTrafficManagerCustomHeaderToEndpoint, Remove-AzureRmTrafficManager...
Script     4.1.1      AzureRM.TrafficManager              {Add-AzureRmTrafficManagerCustomHeaderToEndpoint, Remove-AzureRmTrafficManager...
Script     4.0.5      AzureRM.UsageAggregates             Get-UsageAggregates                                                              
Script     5.2.0      AzureRM.Websites                    {Get-AzureRmAppServicePlan, Set-AzureRmAppServicePlan, New-AzureRmAppServicePl...
Binary     16.0.83... Microsoft.Online.SharePoint.Powe... {Register-SPODataEncryptionPolicy, Update-SPODataEncryptionPolicy, Get-SPOData...
Script     1.0.1      Microsoft.PowerShell.Operation.V... {Get-OperationValidation, Invoke-OperationValidation}                            
Manifest   1.1.183.17 MSOnline                            {Get-MsolDevice, Remove-MsolDevice, Enable-MsolDevice, Disable-MsolDevice...}    
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}           
Script     3.4.0      Pester                              {Describe, Context, It, Should...}                                               
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}                     
Script     1.2        PSReadline                          {Get-PSReadlineKeyHandler, Set-PSReadlineKeyHandler, Remove-PSReadlineKeyHandl...


    Directory: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules


ModuleType Version    Name                                ExportedCommands                                                                 
---------- -------    ----                                ----------------                                                                 
Manifest   1.0.0.0    ActiveDirectory                     {Add-ADCentralAccessPolicyMember, Add-ADComputerServiceAccount, Add-ADDomainCo...
Manifest   1.0.0.0    AppBackgroundTask                   {Disable-AppBackgroundTaskDiagnosticLog, Enable-AppBackgroundTaskDiagnosticLog...
Manifest   2.0.0.0    AppLocker                           {Get-AppLockerFileInformation, Get-AppLockerPolicy, New-AppLockerPolicy, Set-A...
Manifest   1.0.0.0    AppvClient                          {Add-AppvClientConnectionGroup, Add-AppvClientPackage, Add-AppvPublishingServe...
Manifest   2.0.0.0    Appx                                {Add-AppxPackage, Get-AppxPackage, Get-AppxPackageManifest, Remove-AppxPackage...
Script     1.0.0.0    AssignedAccess                      {Clear-AssignedAccess, Get-AssignedAccess, Set-AssignedAccess}                   
Manifest   1.0        BestPractices                       {Get-BpaModel, Get-BpaResult, Invoke-BpaModel, Set-BpaResult}                    
Manifest   1.0.0.0    BitLocker                           {Unlock-BitLocker, Suspend-BitLocker, Resume-BitLocker, Remove-BitLockerKeyPro...
Manifest   2.0.0.0    BitsTransfer                        {Add-BitsFile, Complete-BitsTransfer, Get-BitsTransfer, Remove-BitsTransfer...}  
Manifest   1.0.0.0    BranchCache                         {Add-BCDataCacheExtension, Clear-BCCache, Disable-BC, Disable-BCDowngrading...}  
Manifest   1.0.0.0    CimCmdlets                          {Get-CimAssociatedInstance, Get-CimClass, Get-CimInstance, Get-CimSession...}    
Binary     2.0.0.0    ClusterAwareUpdating                {Get-CauPlugin, Register-CauPlugin, Unregister-CauPlugin, Invoke-CauScan...}     
Manifest   1.0        ConfigCI                            {Get-SystemDriver, New-CIPolicyRule, New-CIPolicy, Get-CIPolicy...}              
Manifest   1.0        Defender                            {Get-MpPreference, Set-MpPreference, Add-MpPreference, Remove-MpPreference...}   
Manifest   1.0.0.0    DeliveryOptimization                {Get-DeliveryOptimizationStatus, Get-DeliveryOptimizationPerfSnap}               
Manifest   1.0        DFSN                                {Get-DfsnRoot, Remove-DfsnRoot, Set-DfsnRoot, New-DfsnRoot...}                   
Binary     2.0.0.0    DFSR                                {New-DfsReplicationGroup, Get-DfsReplicationGroup, Set-DfsReplicationGroup, Re...
Manifest   2.0.0.0    DhcpServer                          {Add-DhcpServerInDC, Add-DhcpServerv4Class, Add-DhcpServerv4ExclusionRange, Ad...
Manifest   1.0.0.0    DirectAccessClientComponents        {Disable-DAManualEntryPointSelection, Enable-DAManualEntryPointSelection, Get-...
Script     3.0        Dism                                {Add-AppxProvisionedPackage, Add-WindowsDriver, Add-WindowsCapability, Add-Win...
Manifest   1.0.0.0    DnsClient                           {Resolve-DnsName, Clear-DnsClientCache, Get-DnsClient, Get-DnsClientCache...}    
Manifest   2.0.0.0    DnsServer                           {Add-DnsServerConditionalForwarderZone, Add-DnsServerDirectoryPartition, Add-D...
Manifest   1.0.0.0    EventTracingManagement              {Start-EtwTraceSession, New-EtwTraceSession, Get-EtwTraceSession, Update-EtwTr...
Manifest   2.0.0.0    FailoverClusters                    {Add-ClusterCheckpoint, Add-ClusterDisk, Add-ClusterFileServerRole, Add-Cluste...
Manifest   1.0.0.0    GroupPolicy                         {Backup-GPO, Block-GPInheritance, Copy-GPO, Get-GPInheritance...}                
Manifest   1.0.0.0    HgsClient                           {Get-HgsAttestationBaselinePolicy, Get-HgsClientConfiguration, Set-HgsClientCo...
Script     1.1.0.0    IISAdministration                   {Get-IISAppPool, Start-IISCommitDelay, Stop-IISCommitDelay, Get-IISSite...}      
Manifest   2.0.0.0    International                       {Get-WinDefaultInputMethodOverride, Set-WinDefaultInputMethodOverride, Get-Win...
Manifest   2.0.0.0    IpamServer                          {Get-IpamDhcpConfigurationEvent, Remove-IpamDhcpConfigurationEvent, Get-IpamCo...
Manifest   1.0.0.0    iSCSI                               {Get-IscsiTargetPortal, New-IscsiTargetPortal, Remove-IscsiTargetPortal, Updat...
Manifest   2.0.0.0    IscsiTarget                         {Add-ClusteriSCSITargetServerRole, Add-IscsiVirtualDiskTargetMapping, Checkpoi...
Script     1.0.0.0    ISE                                 {New-IseSnippet, Import-IseSnippet, Get-IseSnippet}                              
Manifest   1.0.0.0    Kds                                 {Add-KdsRootKey, Get-KdsRootKey, Test-KdsRootKey, Set-KdsConfiguration...}       
Manifest   1.0.1.0    Microsoft.PowerShell.Archive        {Compress-Archive, Expand-Archive}                                               
Manifest   3.0.0.0    Microsoft.PowerShell.Diagnostics    {Get-WinEvent, Get-Counter, Import-Counter, Export-Counter...}                   
Manifest   3.0.0.0    Microsoft.PowerShell.Host           {Start-Transcript, Stop-Transcript}                                              
Manifest   1.0.0.0    Microsoft.PowerShell.LocalAccounts  {Add-LocalGroupMember, Disable-LocalUser, Enable-LocalUser, Get-LocalGroup...}   
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path...}                   
Script     1.0        Microsoft.PowerShell.ODataUtils     Export-ODataEndpointProxy                                                        
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {Get-Acl, Set-Acl, Get-PfxCertificate, Get-Credential...}                        
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Format-List, Format-Custom, Format-Table, Format-Wide...}                       
Manifest   3.0.0.0    Microsoft.WSMan.Management          {Disable-WSManCredSSP, Enable-WSManCredSSP, Get-WSManCredSSP, Set-WSManQuickCo...
Manifest   1.0        MMAgent                             {Disable-MMAgent, Enable-MMAgent, Set-MMAgent, Get-MMAgent...}                   
Manifest   1.0.0.0    MsDtc                               {New-DtcDiagnosticTransaction, Complete-DtcDiagnosticTransaction, Join-DtcDiag...
Manifest   2.0.0.0    NetAdapter                          {Disable-NetAdapter, Disable-NetAdapterBinding, Disable-NetAdapterChecksumOffl...
Manifest   1.0.0.0    NetConnection                       {Get-NetConnectionProfile, Set-NetConnectionProfile}                             
Manifest   1.0.0.0    NetEventPacketCapture               {New-NetEventSession, Remove-NetEventSession, Get-NetEventSession, Set-NetEven...
Manifest   2.0.0.0    NetLbfo                             {Add-NetLbfoTeamMember, Add-NetLbfoTeamNic, Get-NetLbfoTeam, Get-NetLbfoTeamMe...
Manifest   1.0        NetLldpAgent                        {Enable-NetLldpAgent, Disable-NetLldpAgent, Get-NetLldpAgent}                    
Manifest   1.0.0.0    NetNat                              {Get-NetNat, Get-NetNatExternalAddress, Get-NetNatStaticMapping, Get-NetNatSes...
Manifest   2.0.0.0    NetQos                              {Get-NetQosPolicy, Set-NetQosPolicy, Remove-NetQosPolicy, New-NetQosPolicy}      
Manifest   2.0.0.0    NetSecurity                         {Get-DAPolicyChange, New-NetIPsecAuthProposal, New-NetIPsecMainModeCryptoPropo...
Manifest   1.0.0.0    NetSwitchTeam                       {New-NetSwitchTeam, Remove-NetSwitchTeam, Get-NetSwitchTeam, Rename-NetSwitchT...
Manifest   1.0.0.0    NetTCPIP                            {Get-NetIPAddress, Get-NetIPInterface, Get-NetIPv4Protocol, Get-NetIPv6Protoco...
Manifest   1.0.0.0    NetworkConnectivityStatus           {Get-DAConnectionStatus, Get-NCSIPolicyConfiguration, Reset-NCSIPolicyConfigur...
Manifest   1.0.0.0    NetworkController                   {Add-NetworkControllerNode, Disable-NetworkControllerNode, Enable-NetworkContr...
Manifest   1.0.0.0    NetworkControllerDiagnostics        {Get-NetworkControllerDeploymentInfo, Get-NetworkControllerManagedDevices, Deb...
Manifest   2.0.0.0    NetworkLoadBalancingClusters        {Add-NlbClusterNode, Add-NlbClusterNodeDip, Add-NlbClusterPortRule, Add-NlbClu...
Manifest   1.0.0.0    NetworkSwitchManager                {Disable-NetworkSwitchEthernetPort, Enable-NetworkSwitchEthernetPort, Get-Netw...
Manifest   1.0.0.0    NetworkTransition                   {Add-NetIPHttpsCertBinding, Disable-NetDnsTransitionConfiguration, Disable-Net...
Manifest   1.0        NFS                                 {Get-NfsMappedIdentity, Get-NfsNetgroup, Install-NfsMappingStore, New-NfsMappe...
Manifest   1.0.0.0    PcsvDevice                          {Get-PcsvDevice, Start-PcsvDevice, Stop-PcsvDevice, Restart-PcsvDevice...}       
Manifest   1.0.0.0    PKI                                 {Add-CertificateEnrollmentPolicyServer, Export-Certificate, Export-PfxCertific...
Manifest   1.0.0.0    PnpDevice                           {Get-PnpDevice, Get-PnpDeviceProperty, Enable-PnpDevice, Disable-PnpDevice}      
Manifest   1.1        PrintManagement                     {Add-Printer, Add-PrinterDriver, Add-PrinterPort, Get-PrintConfiguration...}     
Binary     1.0.11     ProcessMitigations                  {Get-ProcessMitigation, Set-ProcessMitigation, ConvertTo-ProcessMitigationPolicy}
Script     3.0        Provisioning                        {Install-ProvisioningPackage, Export-ProvisioningPackage, Install-TrustedProvi...
Manifest   1.1        PSDesiredStateConfiguration         {Set-DscLocalConfigurationManager, Start-DscConfiguration, Test-DscConfigurati...
Script     1.0.0.0    PSDiagnostics                       {Disable-PSTrace, Disable-PSWSManCombinedTrace, Disable-WSManTrace, Enable-PST...
Binary     1.1.0.0    PSScheduledJob                      {New-JobTrigger, Add-JobTrigger, Remove-JobTrigger, Get-JobTrigger...}           
Manifest   1.5.1.11   PSWindowsUpdate                     {Add-WUOfflineSync, Get-WUHistory, Get-WUInstall, Get-WUInstallerStatus...}      
Manifest   2.0.0.0    PSWorkflow                          {New-PSWorkflowExecutionOption, New-PSWorkflowSession, nwsn}                     
Manifest   1.0.0.0    PSWorkflowUtility                   Invoke-AsWorkflow                                                                
Manifest   3.0.0.0    RemoteAccess                        {Add-DAAppServer, Add-DAClient, Add-DAClientDnsConfiguration, Add-DAEntryPoint...
Manifest   2.0.0.0    RemoteDesktop                       {Get-RDCertificate, Set-RDCertificate, New-RDCertificate, New-RDVirtualDesktop...
Manifest   1.0.0.0    ScheduledTasks                      {Get-ScheduledTask, Set-ScheduledTask, Register-ScheduledTask, Unregister-Sche...
Manifest   2.0.0.0    SecureBoot                          {Confirm-SecureBootUEFI, Set-SecureBootUEFI, Get-SecureBootUEFI, Format-Secure...
Script     2.0.0.0    ServerManager                       {Get-WindowsFeature, Install-WindowsFeature, Uninstall-WindowsFeature, Enable-...
Cim        1.0.0.0    ServerManagerTasks                  {Get-SMCounterSample, Get-SMPerformanceCollector, Start-SMPerformanceCollector...
Manifest   1.0.0.0    ShieldedVMDataFile                  {Import-ShieldingDataFile, New-ShieldingDataFile, New-VolumeIDQualifier, Save-...
Manifest   1.0.0.0    ShieldedVMTemplate                  {Protect-TemplateDisk, Initialize-VMShieldingHelperVHD}                          
Manifest   2.0.0.0    SmbShare                            {Get-SmbShare, Remove-SmbShare, Set-SmbShare, Block-SmbShareAccess...}           
Manifest   2.0.0.0    SmbWitness                          {Get-SmbWitnessClient, Move-SmbWitnessClient, gsmbw, msmbw...}                   
Manifest   1.0.0.0    StartLayout                         {Export-StartLayout, Import-StartLayout, Export-StartLayoutEdgeAssets, Get-Sta...
Manifest   2.0.0.0    Storage                             {Add-InitiatorIdToMaskingSet, Add-PartitionAccessPath, Add-PhysicalDisk, Add-S...
Manifest   1.0.0.0    StorageQoS                          {Get-StorageQoSPolicy, Get-StorageQoSPolicyStore, Set-StorageQoSPolicyStore, R...
Manifest   1.0        StorageReplica                      {Test-SRTopology, New-SRGroup, Remove-SRGroup, Set-SRGroup...}                   
Manifest   2.0.0.0    TLS                                 {New-TlsSessionTicketKey, Enable-TlsSessionTicketKey, Disable-TlsSessionTicket...
Manifest   1.0.0.0    TroubleshootingPack                 {Get-TroubleshootingPack, Invoke-TroubleshootingPack}                            
Manifest   2.0.0.0    TrustedPlatformModule               {Get-Tpm, Initialize-Tpm, Clear-Tpm, Unblock-Tpm...}                             
Binary     2.1.639.0  UEV                                 {Clear-UevConfiguration, Clear-UevAppxPackage, Restore-UevBackup, Set-UevTempl...
Manifest   2.0.0.0    UpdateServices                      {Add-WsusComputer, Approve-WsusUpdate, Deny-WsusUpdate, Get-WsusClassification...
Manifest   2.0.0.0    VpnClient                           {Add-VpnConnection, Set-VpnConnection, Remove-VpnConnection, Get-VpnConnection...
Manifest   1.0.0.0    Wdac                                {Get-OdbcDriver, Set-OdbcDriver, Get-OdbcDsn, Add-OdbcDsn...}                    
Manifest   1.0.0.0    WebAdministration                   {Start-WebCommitDelay, Stop-WebCommitDelay, Get-WebConfigurationLock, Remove-W...
Manifest   1.0.0.0    WindowsDeveloperLicense             {Get-WindowsDeveloperLicense, Unregister-WindowsDeveloperLicense, Show-Windows...
Script     1.0        WindowsErrorReporting               {Enable-WindowsErrorReporting, Disable-WindowsErrorReporting, Get-WindowsError...
Manifest   1.0.0.0    WindowsSearch                       {Get-WindowsSearchSetting, Set-WindowsSearchSetting}                             
Manifest   1.0.0.0    WindowsUpdate                       Get-WindowsUpdateLog                                                             
Manifest   1.0.0.2    WindowsUpdateProvider               {Get-WUAVersion, Get-WULastInstallationDate, Get-WULastScanSuccessDate, Get-WU...


    Directory: C:\Program Files (x86)\Microsoft SQL Server\120\Tools\PowerShell\Modules


ModuleType Version    Name                                ExportedCommands                                                                 
---------- -------    ----                                ----------------                                                                 
Manifest   1.0        SQLASCMDLETS                        {Add-RoleMember, Backup-ASDatabase, Invoke-ASCmd, Invoke-ProcessCube...}         
Manifest   1.0        SQLPS                               {Backup-SqlDatabase, Add-SqlAvailabilityDatabase, Add-SqlAvailabilityGroupList...

@maddieclayton
Copy link
Contributor

@TomaszOledzki Would you be able to provide the information requested from the original poster?
(1) Uninstall all instances of AzureRM on your machine and install the new Az module. More information here.
(2) If you're still seeing this error with the Az module, set $DebugPreference = "Continue", re-run the command, and send us the resulting debug stream. Also, sending the result of Resolve-AzError after the command has thrown an exception will help to get the full error details as well.
(3) Confirm whether or not this exception occurs for all resource types that you try, or specific ones.

@JohannesHoppe
Copy link

I'm super frustrated. Can't something just work?
To make it super simple, I just read and write the same object.
Even this simple script is exploding:

       $p1 = @{
            ResourceGroupName = $resourceGroupName
            ResourceType = "Microsoft.Web/sites/config"
            ResourceName = $resourceName
            ApiVersion = "2018-02-01"
        }
        $WebAppConfig = Get-AzResource @p1
        $WebAppConfig | Set-AzResource -ApiVersion 2018-02-01 -Force | Out-Null
Set-AzResource : The input object cannot be bound because it did not contain the information required to bind all mandatory parameters:  InputObject
At xxx.ps1:56 char:25
+         $WebAppConfig | Set-AzResource -Force | Out-Null
+                         ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (@{Name=xxxx; Properties=}:PSObject) [Set-AzResource], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectMissingMandatory,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.SetAzureResourceCmdlet

@JohannesHoppe
Copy link

JohannesHoppe commented Feb 14, 2019

And no, this is a fresh machine. There is no AzureRM installed. And no, Resolve-AzError does not display any new information...
😞

@maddieclayton
Copy link
Contributor

@would you be able these two items?
(1) Set $DebugPreference = "Continue", re-run the command, and send us the resulting debug stream.
(2) Confirm whether or not this exception occurs for all resource types that you try, or specific ones.

@tspring418
Copy link

tspring418 commented Feb 20, 2019

Hello Everyone, i just tested this and it seems to be related to the the piping.
$WebAppConfig | Set-AzureRmResource -ApiVersion $APIVersion -Force | Out-Null

Try this:
Set-AzureRmResource -resourceid $webAppConfig.ResourceId -Properties $WebAppConfig -ApiVersion $APIVersion -Force

This appears to work

EDIT: Apparently it will run and complete with that flag added , but won't actually change the ip restrictions. Seems it may be related to the command then in the new version, was having issues on 6.7.0

@TomaszOledzki
Copy link

Hi All

As tspring418 suggested, this command works for me. I was able to update/change iprestrictions and save using following command
Set-AzureRmResource -resourceid $webAppConfig.ResourceId -Properties $WebAppConfig -ApiVersion $APIVersion -Force

Looks like the issue is in example on the docs site not having correct parameters for Set-AzureRmResource command.

@cormacpayne
Copy link
Member

The fix for this issue can be found here: #8593

It looks like PowerShell was trying to convert the PSCustomObject that was being returned from Get-AzResource to the PSResource type expected for the -InputObject parameter of Set-AzResource, but failed when it was unable to. The PR changes the type of the object returned in this scenario PSResource so that it can be properly bound to the -InputObject parameter for Set-AzResource. This should go in for the 2019-03-12 release. In the meantime, calling out the property parameters, as mentioned by @tspring418 , is the recommended way to update a resource when using the object returned from Get-AzResource.

@JohannesHoppe
Copy link

JohannesHoppe commented Mar 4, 2019

Just for the records, executing this:

Set-AzResource -resourceid $WebAppConfig.ResourceId -Properties $WebAppConfig -ApiVersion 2018-02-01 -Force

won't work. No exception is thrown, but also nothing happens!

@tspring418
Copy link

@JohannesHoppe Yeah, i found that to be the case as well. I edited my comment previously to state that there is no change in the ip restrictions when i tested this, so it seems to run fine but doesn't actually perform anything, which is certainly strange!

@JohannesHoppe
Copy link

This is very frustrating! How I am supposed to manage our (expensive) infrastructure on Azure? By hand???

@TomaszOledzki
Copy link

TomaszOledzki commented Mar 6, 2019

Just for the records, executing this:

Set-AzResource -resourceid $WebAppConfig.ResourceId -Properties $WebAppConfig -ApiVersion 2018-02-01 -Force

won't work. No exception is thrown, but also nothing happens!

Example code I'm using to update existing rule in ipSecurityRestrictions. Works on AzureRM 6.13.1 and Api 2018-11-01:

$publicIpAddr = "0.0.0.0"
$webAppConfig = (Get-AzureRmResource -ResourceType "Microsoft.Web/sites/config" -ResourceGroupName $resourceGroupName -ResourceName $webAppName -ApiVersion $apiVersion);
$rule = [PSCustomObject] @{
	ipAddress = $publicIpAddr + "/32"
	action = $webAppConfig.Properties.ipSecurityRestrictions[0].action
	tag = $webAppConfig.Properties.ipSecurityRestrictions[0].tag
	priority = $webAppConfig.Properties.ipSecurityRestrictions[0].priority
	name = $webAppConfig.Properties.ipSecurityRestrictions[0].name
}
$webAppConfig.Properties.ipSecurityRestrictions = $webAppConfig.Properties.ipSecurityRestrictions + $rule | Group-Object name | ForEach-Object { $_.Group | Select-Object -Last 1 };
Set-AzureRmResource -ResourceId $webAppConfig.ResourceId -Properties $webAppConfig.Properties -ApiVersion $apiVersion -Force;

@cormacpayne
Copy link
Member

The fix for this piping scenario will be available in the upcoming release of Az (version 1.5.0 released on March 12th, 2019).

@JohannesHoppe would you mind filing a separate issue for the bug you're seeing with Set-AzResource not working as intended so we can get the full steps to repro this, as well as the debug trace? Thanks in advance 😀

@JohannesHoppe
Copy link

@cormacpayne I reported my issue in #8784. Unfortunately 1.5.0 had no effect to my issue. 😞

@cormacpayne
Copy link
Member

@JohannesHoppe thanks for filing the separate issue -- I just want to mention that 1.5.0 shouldn't have any effect on the issue you're seeing with certain properties not getting updated, since we only fixed the broken piping scenario, but we will investigate the issue you (and others) are seeing that's outlined in the issue you opened.

@AshokPadarthi
Copy link

@JohannesHoppe @tspring418 passing $WebAppConfig.Properties rather than $webAppConfig for -Properties fixed the issue , please find the details
AzureRM Version: 6.7.0
$ApiVersion = "2018-11-01"
$WebAppConfig = (Get-AzureRMResource -ResourceType Microsoft.Web/sites/config -ResourceName $webapp.Name -ResourceGroupName $ResourceGroupName -ApiVersion $ApiVersion)

    $rule = [PSCustomObject]@{
        ipAddress = "$($publicIpAddress.IpAddress)/32"
        action = "Allow"
        priority = 1
        #tag = "Default"
        name = '{0}_{1}' -f $AAGName, $($publicIpAddress.Name)
        description = "Automatically added ip restriction of Application gateway"
    }
    $WebAppConfig.Properties.ipsecurityrestrictions = @($rule)
    Set-AzureRMResource -Properties $WebAppConfig.Properties  -ApiVersion $ApiVersion -ResourceId $WebAppConfig.ResourceId -Force

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants